public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements JobExecutionDao, org.springframework.beans.factory.InitializingBean
JobExecutionDao. Uses sequences (via Spring's
DataFieldMaxValueIncrementer abstraction) to create all primary keys
before inserting a new row. Objects are checked to ensure all mandatory
fields to be stored are not null. If any are found to be null, an
IllegalArgumentException will be thrown. This could be left to JdbcTemplate,
however, the exception will be fairly vague, and fails to highlight which
field caused the exception.DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX| Constructor and Description |
|---|
JdbcJobExecutionDao() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
java.util.List<JobExecution> |
findJobExecutions(JobInstance job)
Return all
JobExecution for given JobInstance, sorted
backwards by creation order (so the first element is the most recent). |
java.util.Set<JobExecution> |
findRunningJobExecutions(java.lang.String jobName) |
JobExecution |
getJobExecution(java.lang.Long executionId) |
protected JobParameters |
getJobParameters(java.lang.Long executionId) |
JobExecution |
getLastJobExecution(JobInstance jobInstance)
Find the last
JobExecution to have been created for a given
JobInstance. |
void |
saveJobExecution(JobExecution jobExecution)
SQL implementation using Sequences via the Spring incrementer
abstraction.
|
void |
setExitMessageLength(int exitMessageLength)
Public setter for the exit message length in database.
|
void |
setJobExecutionIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobExecutionIncrementer)
Setter for
DataFieldMaxValueIncrementer to be used when
generating primary keys for JobExecution instances. |
void |
synchronizeStatus(JobExecution jobExecution)
Because it may be possible that the status of a JobExecution is updated
while running, the following method will synchronize only the status and
version fields.
|
void |
updateJobExecution(JobExecution jobExecution)
Update given JobExecution using a SQL UPDATE statement.
|
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefixpublic void setExitMessageLength(int exitMessageLength)
exitMessageLength - the exitMessageLength to setpublic void setJobExecutionIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobExecutionIncrementer)
DataFieldMaxValueIncrementer to be used when
generating primary keys for JobExecution instances.jobExecutionIncrementer - the DataFieldMaxValueIncrementerpublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class AbstractJdbcBatchMetadataDaojava.lang.Exceptionpublic java.util.List<JobExecution> findJobExecutions(JobInstance job)
JobExecutionDaoJobExecution for given JobInstance, sorted
backwards by creation order (so the first element is the most recent).findJobExecutions in interface JobExecutionDaopublic void saveJobExecution(JobExecution jobExecution)
saveJobExecution in interface JobExecutionDaojava.lang.IllegalArgumentException - if jobExecution is null, as well as any
of it's fields to be persisted.JobExecutionDao.saveJobExecution(JobExecution)public void updateJobExecution(JobExecution jobExecution)
updateJobExecution in interface JobExecutionDaoJobExecutionDao.updateJobExecution(JobExecution)public JobExecution getLastJobExecution(JobInstance jobInstance)
JobExecutionDaoJobExecution to have been created for a given
JobInstance.getLastJobExecution in interface JobExecutionDaojobInstance - the JobInstanceJobExecution to execute for this instancepublic JobExecution getJobExecution(java.lang.Long executionId)
getJobExecution in interface JobExecutionDaoJobExecution for given identifier.public java.util.Set<JobExecution> findRunningJobExecutions(java.lang.String jobName)
findRunningJobExecutions in interface JobExecutionDaoJobExecution that are still running (or indeterminate
state), i.e. having null end date, for the specified job name.public void synchronizeStatus(JobExecution jobExecution)
JobExecutionDaosynchronizeStatus in interface JobExecutionDaojobExecution - to be updated.protected JobParameters getJobParameters(java.lang.Long executionId)
executionId -