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.
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 Summary
Modifier and TypeMethodDescriptionvoidexecute(JobExecution execution) Run theJobExecutionand update the meta information, such as status and statistics, as necessary.default @Nullable JobParametersIncrementerIf clients need to generate new parameters for the next execution in a sequence, they can use this incrementer.default JobParametersValidatorA validator for the job parameters of aJobExecution.default StringgetName()The name of the job.default booleanFlag to indicate if this job can be restarted, at least in principle.
-
Method Details
-
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
Run theJobExecutionand 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 theJobExecutionstatus to determine success or failure. The only exception that can be thrown from this method isJobInterruptedExceptionwhich indicates that the job was interrupted externally (for example by a user request). In this case the status of the execution will be set toBatchStatus.STOPPEDand theJobExecutionwill be updated accordingly.- Parameters:
execution- aJobExecution- Throws:
JobInterruptedException
-
getJobParametersIncrementer
If clients need to generate new parameters for the next execution in a sequence, they can use this incrementer. The return value may benull, when this job does not have a natural sequence.- Returns:
- an incrementer to be used for creating new parameters. Defaults to
null.
-
getJobParametersValidator
A validator for the job parameters of aJobExecution. Clients of aJobmay 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 toDefaultJobParametersValidator.
-