Class SimpleJobOperator
java.lang.Object
org.springframework.batch.core.launch.support.TaskExecutorJobLauncher
org.springframework.batch.core.launch.support.SimpleJobOperator
- All Implemented Interfaces:
JobLauncher,JobOperator,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
TaskExecutorJobOperator
@Deprecated(since="6.0",
forRemoval=true)
public class SimpleJobOperator
extends TaskExecutorJobLauncher
implements JobOperator, org.springframework.beans.factory.InitializingBean
Deprecated, for removal: This API element is subject to removal in a future version.
Simple implementation of the
JobOperator interface. the following dependencies
are required:
This class can be instantiated with a JobOperatorFactoryBean to create a
transactional proxy around the job operator.- Since:
- 2.0
- Author:
- Dave Syer, Lucas Ward, Will Schipp, Mahmoud Ben Hassine, Andrey Litvitski, Yejeong Ham
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JobParametersConverterDeprecated, for removal: This API element is subject to removal in a future version.protected JobRegistryDeprecated, for removal: This API element is subject to removal in a future version.Fields inherited from class org.springframework.batch.core.launch.support.TaskExecutorJobLauncher
jobLaunchCount, jobRepository, meterRegistry, taskExecutor -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionabandon(long jobExecutionId) Deprecated, for removal: This API element is subject to removal in a future version.abandon(JobExecution jobExecution) Deprecated, for removal: This API element is subject to removal in a future version.Mark theJobExecutionas ABANDONED.voidDeprecated, for removal: This API element is subject to removal in a future version.Check mandatory properties.getExecutions(long instanceId) Deprecated, for removal: This API element is subject to removal in a future version.getJobInstance(String jobName, JobParameters jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.getJobInstances(String jobName, int start, int count) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.getParameters(long executionId) Deprecated, for removal: This API element is subject to removal in a future version.getRunningExecutions(String jobName) Deprecated, for removal: This API element is subject to removal in a future version.getStepExecutionSummaries(long executionId) Deprecated, for removal: This API element is subject to removal in a future version.getSummary(long executionId) Deprecated, for removal: This API element is subject to removal in a future version.recover(JobExecution jobExecution) Deprecated, for removal: This API element is subject to removal in a future version.Marks the givenJobExecutionasFAILEDwhen it is stuck in aSTARTEDstate due to an abrupt shutdown or failure, in order to make it restartable.restart(long executionId) Deprecated, for removal: This API element is subject to removal in a future version.restart(JobExecution jobExecution) Deprecated, for removal: This API element is subject to removal in a future version.Restart a failed or stoppedJobExecution.voidsetJobParametersConverter(JobParametersConverter jobParametersConverter) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 with no replacement.voidsetJobRegistry(JobRegistry jobRegistry) Deprecated, for removal: This API element is subject to removal in a future version.Public setter for theJobRegistry.start(String jobName, Properties parameters) Deprecated, for removal: This API element is subject to removal in a future version.start(Job job, JobParameters jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.Start a new instance of a job with the specified parameters.startNextInstance(String jobName) Deprecated, for removal: This API element is subject to removal in a future version.startNextInstance(Job job) Deprecated, for removal: This API element is subject to removal in a future version.Launch the next in a sequence ofJobInstancedetermined by theJobParametersIncrementerattached to the specified job.booleanstop(long executionId) Deprecated, for removal: This API element is subject to removal in a future version.booleanstop(JobExecution jobExecution) Deprecated, for removal: This API element is subject to removal in a future version.Send a stop signal to the suppliedJobExecution.Methods inherited from class org.springframework.batch.core.launch.support.TaskExecutorJobLauncher
run, setJobRepository, setMeterRegistry, setTaskExecutorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.batch.core.launch.JobLauncher
run
-
Field Details
-
jobRegistry
Deprecated, for removal: This API element is subject to removal in a future version. -
jobParametersConverter
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
SimpleJobOperator
public SimpleJobOperator()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
afterPropertiesSet
Deprecated, for removal: This API element is subject to removal in a future version.Check mandatory properties.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classTaskExecutorJobLauncher- Throws:
Exception- See Also:
-
InitializingBean.afterPropertiesSet()
-
setJobParametersConverter
@Deprecated(since="6.0", forRemoval=true) public void setJobParametersConverter(JobParametersConverter jobParametersConverter) Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 with no replacement. Scheduled for removal in 6.2 or later.Public setter for theJobParametersConverter.- Parameters:
jobParametersConverter- theJobParametersConverterto set
-
setJobRegistry
Deprecated, for removal: This API element is subject to removal in a future version.Public setter for theJobRegistry.- Parameters:
jobRegistry- theJobRegistryto set
-
start
@Deprecated(since="6.0", forRemoval=true) public Long start(String jobName, Properties parameters) throws NoSuchJobException, JobInstanceAlreadyExistsException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorStart a new instance of a job with the parameters specified.- Specified by:
startin interfaceJobOperator- Parameters:
jobName- the name of theJobto launchparameters- the parameters to launch it with- Returns:
- the id of the
JobExecutionthat is launched - Throws:
NoSuchJobException- if there is noJobwith the specified nameJobInstanceAlreadyExistsException- if a job instance with this name and parameters already existsJobParametersInvalidException- thrown if any of the job parameters are invalid.
-
start
public JobExecution start(Job job, JobParameters jobParameters) throws NoSuchJobException, JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobRestartException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Start a new instance of a job with the specified parameters. If the job defines aJobParametersIncrementer, then the incrementer will be used to calculate the next parameters in the sequence and the provided parameters will be ignored.- Specified by:
startin interfaceJobOperator- Parameters:
job- theJobto startjobParameters- theJobParametersto start the job with- Returns:
- the
JobExecutionthat was started - Throws:
NoSuchJobException- if the givenJobis not registeredJobParametersInvalidException- thrown if any of the job parameters areJobExecutionAlreadyRunningException- if the JobInstance identified by the properties already has an execution running. invalid.JobRestartException- if the execution would be a re-start, but a re-start is either not allowed or not needed.JobInstanceAlreadyCompleteException- if the job has been run before with the same parameters and completed successfullyIllegalArgumentException- if the job or job parameters are null.
-
restart
@Deprecated(since="6.0", forRemoval=true) public Long restart(long executionId) throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorRestart a failed or stoppedJobExecution. Fails with an exception if the id provided does not exist or corresponds to aJobInstancethat in normal circumstances already completed successfully.- Specified by:
restartin interfaceJobOperator- Parameters:
executionId- the id of a failed or stoppedJobExecution- Returns:
- the id of the
JobExecutionthat was started - Throws:
JobInstanceAlreadyCompleteException- if the job was already successfully completedNoSuchJobExecutionException- if the id was not associated with anyJobExecutionNoSuchJobException- if theJobExecutionwas found, but its correspondingJobis no longer available for launchingJobRestartException- if there is a non-specific error with the restart (e.g. corrupt or inconsistent restart data)JobParametersInvalidException- if the parameters are not valid for this job
-
restart
public JobExecution restart(JobExecution jobExecution) throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorRestart a failed or stoppedJobExecution. Fails with an exception if the execution provided does not exist or corresponds to aJobInstancethat in normal circumstances already completed successfully.- Specified by:
restartin interfaceJobOperator- Parameters:
jobExecution- the failed or stoppedJobExecutionto restart- Returns:
- the
JobExecutionthat was started - Throws:
JobInstanceAlreadyCompleteException- if the job was already successfully completedNoSuchJobExecutionException- if the id was not associated with anyJobExecutionNoSuchJobException- if theJobExecutionwas found, but its correspondingJobis no longer available for launchingJobRestartException- if there is a non-specific error with the restart (e.g. corrupt or inconsistent restart data)JobParametersInvalidException- if the parameters are not valid for this job
-
startNextInstance
@Deprecated(since="6.0", forRemoval=true) public Long startNextInstance(String jobName) throws NoSuchJobException, UnexpectedJobExecutionException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorLaunch the next in a sequence ofJobInstancedetermined by theJobParametersIncrementerattached to the specified job. If the previous instance is still in a failed state, this method should still create a new instance and run it with different parameters (as long as theJobParametersIncrementeris working).
The last three exception described below should be extremely unlikely, but cannot be ruled out entirely. It points to some other thread or process trying to use this method (or a similar one) at the same time.- Specified by:
startNextInstancein interfaceJobOperator- Parameters:
jobName- the name of the job to launch- Returns:
- the
JobExecutionid of the execution created when the job is launched - Throws:
NoSuchJobException- if there is no such job definition availableUnexpectedJobExecutionException- if an unexpected condition arisesJobParametersInvalidException- thrown if some of the job parameters are invalid.
-
startNextInstance
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorLaunch the next in a sequence ofJobInstancedetermined by theJobParametersIncrementerattached to the specified job. If the previous instance is still in a failed state, this method should still create a new instance and run it with different parameters (as long as theJobParametersIncrementeris working).
The last three exception described below should be extremely unlikely, but cannot be ruled out entirely. It points to some other thread or process trying to use this method (or a similar one) at the same time.- Specified by:
startNextInstancein interfaceJobOperator- Parameters:
job- the job to launch- Returns:
- the
JobExecutioncreated when the job is launched - Throws:
UnexpectedJobExecutionException- if an unexpected condition arises
-
stop
@Deprecated(since="6.0", forRemoval=true) public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorSend a stop signal to theJobExecutionwith the supplied id. The signal is successfully sent if this method returns true, but that doesn't mean that the job has stopped. The only way to be sure of that is to poll the job execution status.- Specified by:
stopin interfaceJobOperator- Parameters:
executionId- the id of a runningJobExecution- Returns:
- true if the message was successfully sent (does not guarantee that the job has stopped)
- Throws:
NoSuchJobExecutionException- if there is noJobExecutionwith the id suppliedJobExecutionNotRunningException- if theJobExecutionis not running (so cannot be stopped)
-
stop
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorSend a stop signal to the suppliedJobExecution. The signal is successfully sent if this method returns true, but that doesn't mean that the job has stopped. The only way to be sure of that is to poll the job execution status.- Specified by:
stopin interfaceJobOperator- Parameters:
jobExecution- the runningJobExecution- Returns:
- true if the message was successfully sent (does not guarantee that the job has stopped)
- Throws:
JobExecutionNotRunningException- if the suppliedJobExecutionis not running (so cannot be stopped)
-
abandon
@Deprecated(since="6.0", forRemoval=true) public JobExecution abandon(long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorMark theJobExecutionas ABANDONED. If a stop signal is ignored because the process died this is the best way to mark a job as finished with (as opposed to STOPPED). An abandoned job execution cannot be restarted by the framework.- Specified by:
abandonin interfaceJobOperator- Parameters:
jobExecutionId- the job execution id to abort- Returns:
- the
JobExecutionthat was aborted - Throws:
NoSuchJobExecutionException- thrown if there is no job execution for the jobExecutionId.JobExecutionAlreadyRunningException- if the job is running (it should be stopped first)
-
abandon
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorMark theJobExecutionas ABANDONED. If a stop signal is ignored because the process died this is the best way to mark a job as finished with (as opposed to STOPPED). An abandoned job execution cannot be restarted by the framework.- Specified by:
abandonin interfaceJobOperator- Parameters:
jobExecution- the job execution to abort- Returns:
- the
JobExecutionthat was aborted - Throws:
JobExecutionAlreadyRunningException- if the job execution is running (it should be stopped first)
-
recover
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorMarks the givenJobExecutionasFAILEDwhen it is stuck in aSTARTEDstate due to an abrupt shutdown or failure, in order to make it restartable. This operation makes a previously non-restartable execution eligible for restart by updating its execution context with the flagrecovered=true.- Specified by:
recoverin interfaceJobOperator- Parameters:
jobExecution- theJobExecutionto recover- Returns:
- the
JobExecutionafter it has been marked as recovered
-
getJobNames
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorList the available job names that can be launched withJobOperator.start(String, Properties).- Specified by:
getJobNamesin interfaceJobOperator- Returns:
- a set of job names
-
getExecutions
@Deprecated(since="6.0", forRemoval=true) public List<Long> getExecutions(long instanceId) throws NoSuchJobInstanceException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorList theJobExecutionsassociated with a particularJobInstance, in reverse order of creation (and therefore usually of execution).- Specified by:
getExecutionsin interfaceJobOperator- Parameters:
instanceId- the id of aJobInstance- Returns:
- the id values of all the
JobExecutionsassociated with this instance - Throws:
NoSuchJobInstanceException- if theJobInstanceassociated with theinstanceIdcannot be found.
-
getJobInstances
@Deprecated(since="6.0", forRemoval=true) public List<Long> getJobInstances(String jobName, int start, int count) throws NoSuchJobException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorList theJobInstancesfor a given job name, in reverse order of creation (and therefore usually of first execution).- Specified by:
getJobInstancesin interfaceJobOperator- Parameters:
jobName- the job name that all the instances havestart- the start index of the instancescount- the maximum number of values to return- Returns:
- the id values of the
JobInstances - Throws:
NoSuchJobException- is thrown if noJobInstances for the jobName exist.
-
getJobInstance
@Nullable @Deprecated(since="6.0", forRemoval=true) public JobInstance getJobInstance(String jobName, JobParameters jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getJobInstancein interfaceJobOperator- Parameters:
jobName-Stringname of the job.jobParameters-JobParametersparameters for the job instance.- Returns:
- the
JobInstancewith the given name and parameters, ornull.
-
getParameters
@Deprecated(since="6.0", forRemoval=true) public String getParameters(long executionId) throws NoSuchJobExecutionException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorGet theJobParametersas a human readable String (new line separated key=value pairs).- Specified by:
getParametersin interfaceJobOperator- Parameters:
executionId- the id of an existingJobExecution- Returns:
- the job parameters that were used to launch the associated instance
- Throws:
NoSuchJobExecutionException- if the id was not associated with anyJobExecution
-
getRunningExecutions
@Deprecated(since="6.0", forRemoval=true) public Set<Long> getRunningExecutions(String jobName) throws NoSuchJobException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorGet the id values of all the runningJobExecutionswith the given job name.- Specified by:
getRunningExecutionsin interfaceJobOperator- Parameters:
jobName- the name of the job to search under- Returns:
- the id values of the running
JobExecutioninstances - Throws:
NoSuchJobException- if there are noJobExecutionswith that job name
-
getStepExecutionSummaries
@Deprecated(since="6.0", forRemoval=true) public Map<Long,String> getStepExecutionSummaries(long executionId) throws NoSuchJobExecutionException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorSummarise theStepExecutioninstances belonging to theJobExecutionwith the supplied id, giving details of status, start and end times etc.- Specified by:
getStepExecutionSummariesin interfaceJobOperator- Parameters:
executionId- the id of an existingJobExecution- Returns:
- a map of step execution id to String summarising the state of the execution
- Throws:
NoSuchJobExecutionException- if there is noJobExecutionwith the supplied id
-
getSummary
@Deprecated(since="6.0", forRemoval=true) public String getSummary(long executionId) throws NoSuchJobExecutionException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JobOperatorSummarise theJobExecutionwith the supplied id, giving details of status, start and end times etc.- Specified by:
getSummaryin interfaceJobOperator- Parameters:
executionId- the id of an existingJobExecution- Returns:
- a String summarising the state of the job execution
- Throws:
NoSuchJobExecutionException- if there is noJobExecutionwith the supplied id
-
TaskExecutorJobOperator. Scheduled for removal in 6.2 or later.