Interface Job

All Known Implementing Classes:
AbstractJob, FlowJob, GroupAwareJob, SimpleJob
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Job
Batch domain object representing a job. Job is an explicit abstraction representing the configuration of a job specified by a developer. Note that the restart policy is applied to the job as a whole and not to a step.
Author:
Dave Syer, Mahmoud Ben Hassine
  • Method Details

    • getName

      default String getName()
      The name of the job. This is used to distinguish between different jobs and must be unique within the job repository. If not explicitly set, the name will default to the fully qualified class name.
      Returns:
      the name of the job (never null)
    • isRestartable

      default boolean isRestartable()
      Flag to indicate if this job can be restarted, at least in principle.
      Returns:
      true if this job can be restarted after a failure. Defaults to true.
    • execute

      void execute(JobExecution execution) throws JobInterruptedException
      Run the JobExecution and update the meta information, such as status and statistics, as necessary. This method should not throw any exceptions for failed executions. Clients should be careful to inspect the JobExecution status to determine success or failure. The only exception that can be thrown from this method is JobInterruptedException which indicates that the job was interrupted externally (for example by a user request). In this case the status of the execution will be set to BatchStatus.STOPPED and the JobExecution will be updated accordingly.
      Parameters:
      execution - a JobExecution
      Throws:
      JobInterruptedException
    • getJobParametersIncrementer

      default @Nullable JobParametersIncrementer getJobParametersIncrementer()
      If clients need to generate new parameters for the next execution in a sequence, they can use this incrementer. The return value may be null, when this job does not have a natural sequence.
      Returns:
      an incrementer to be used for creating new parameters. Defaults to null.
    • getJobParametersValidator

      default JobParametersValidator getJobParametersValidator()
      A validator for the job parameters of a JobExecution. Clients of a Job may need to validate the parameters for a launch or before or during the execution.
      Returns:
      a validator that can be used to check parameter values (never null). Defaults to DefaultJobParametersValidator.