Interface JobLauncher
- All Known Implementing Classes:
SimpleJobLauncher
,TaskExecutorJobLauncher
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Simple interface for controlling jobs, including possible ad-hoc executions, based on
different runtime identifiers. It is extremely important to note that this interface
makes absolutely no guarantees about whether or not calls to it are executed
synchronously or asynchronously. The javadocs for specific implementations should be
checked to ensure callers fully understand how the job will be run.
- Author:
- Lucas Ward, Dave Syer, Taeik Lim, Mahmoud Ben Hassine
-
Method Summary
Modifier and TypeMethodDescriptionrun
(Job job, JobParameters jobParameters) Start a job execution for the givenJob
andJobParameters
.
-
Method Details
-
run
JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException Start a job execution for the givenJob
andJobParameters
. If aJobExecution
was able to be created successfully, it will always be returned by this method, regardless of whether or not the execution was successful. If there is a pastJobExecution
which has paused, the sameJobExecution
is returned instead of a new one created. A exception will only be thrown if there is a failure to start the job. If the job encounters some error while processing, the JobExecution will be returned, and the status will need to be inspected.- Parameters:
job
- the job to be executed.jobParameters
- the parameters passed to this execution of the job.- Returns:
- the
JobExecution
if it returns synchronously. If the implementation is asynchronous, the status might well be unknown. - Throws:
JobExecutionAlreadyRunningException
- if the JobInstance identified by the properties already has an execution running.IllegalArgumentException
- if the job or jobInstanceProperties are null.JobRestartException
- if the job has been run before and circumstances that preclude a re-start.JobInstanceAlreadyCompleteException
- if the job has been run before with the same parameters and completed successfullyJobParametersInvalidException
- if the parameters are not valid for this job
-