Class JdbcJobExecutionDao

  • All Implemented Interfaces:
    JobExecutionDao, org.springframework.beans.factory.InitializingBean

    public class JdbcJobExecutionDao
    extends AbstractJdbcBatchMetadataDao
    implements JobExecutionDao, org.springframework.beans.factory.InitializingBean
    JDBC implementation of 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.
    Author:
    Lucas Ward, Dave Syer, Robert Kasanicky, Michael Minella, Mahmoud Ben Hassine, Dimitrios Liapis
    • Constructor Detail

      • JdbcJobExecutionDao

        public JdbcJobExecutionDao()
    • Method Detail

      • setExitMessageLength

        public void setExitMessageLength​(int exitMessageLength)
        Public setter for the exit message length in database. Do not set this if you haven't modified the schema.
        Parameters:
        exitMessageLength - the exitMessageLength to set
      • setJobExecutionIncrementer

        public void setJobExecutionIncrementer​(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobExecutionIncrementer)
        Setter for DataFieldMaxValueIncrementer to be used when generating primary keys for JobExecution instances.
        Parameters:
        jobExecutionIncrementer - the DataFieldMaxValueIncrementer
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class AbstractJdbcBatchMetadataDao
        Throws:
        java.lang.Exception
      • saveJobExecution

        public void saveJobExecution​(JobExecution jobExecution)
        SQL implementation using Sequences via the Spring incrementer abstraction. Once a new id has been obtained, the JobExecution is saved via a SQL INSERT statement.
        Specified by:
        saveJobExecution in interface JobExecutionDao
        Parameters:
        jobExecution - JobExecution instance to be saved.
        Throws:
        java.lang.IllegalArgumentException - if jobExecution is null, as well as any of it's fields to be persisted.
        See Also:
        JobExecutionDao.saveJobExecution(JobExecution)
      • findRunningJobExecutions

        public java.util.Set<JobExecution> findRunningJobExecutions​(java.lang.String jobName)
        Specified by:
        findRunningJobExecutions in interface JobExecutionDao
        Parameters:
        jobName - String containing the name of the job.
        Returns:
        all JobExecution that are still running (or indeterminate state), i.e. having null end date, for the specified job name.
      • synchronizeStatus

        public void synchronizeStatus​(JobExecution jobExecution)
        Description copied from interface: JobExecutionDao
        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.
        Specified by:
        synchronizeStatus in interface JobExecutionDao
        Parameters:
        jobExecution - to be updated.
      • getJobParameters

        protected JobParameters getJobParameters​(java.lang.Long executionId)
        Parameters:
        executionId - Long containing the id for the execution.
        Returns:
        job parameters for the requested execution id