Class SimpleJobLauncher
java.lang.Object
org.springframework.batch.core.launch.support.SimpleJobLauncher
- All Implemented Interfaces:
JobLauncher
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
TaskExecutorJobLauncher
@Deprecated(since="5.0.0",
forRemoval=true)
public class SimpleJobLauncher
extends Object
implements JobLauncher, org.springframework.beans.factory.InitializingBean
Deprecated, for removal: This API element is subject to removal in a future version.
Simple implementation of the
JobLauncher
interface. The Spring Core
TaskExecutor
interface is used to launch a Job
. This means that the
type of executor set is very important. If a SyncTaskExecutor
is used, then the
job will be processed within the same thread that called the launcher.
Care should be taken to ensure any users of this class understand fully whether or not
the implementation of TaskExecutor used will start tasks synchronously or
asynchronously. The default setting uses a synchronous task executor.
There is only one required dependency of this Launcher, a JobRepository
. The
JobRepository is used to obtain a valid JobExecution. The Repository must be used
because the provided Job
could be a restart of an existing JobInstance
,
and only the Repository can reliably recreate it.
- Since:
- 1.0
- Author:
- Lucas Ward, Dave Syer, Will Schipp, Michael Minella, Mahmoud Ben Hassine
- See Also:
-
JobRepository
TaskExecutor
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.apache.commons.logging.Log
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated, for removal: This API element is subject to removal in a future version.Ensure the required dependencies of aJobRepository
have been set.run
(Job job, JobParameters jobParameters) Deprecated, for removal: This API element is subject to removal in a future version.Run the provided job with the givenJobParameters
.void
setJobRepository
(JobRepository jobRepository) Deprecated, for removal: This API element is subject to removal in a future version.Set the JobRepository.void
setMeterRegistry
(io.micrometer.core.instrument.MeterRegistry meterRegistry) Deprecated, for removal: This API element is subject to removal in a future version.Set the meter registry to use for metrics.void
setTaskExecutor
(org.springframework.core.task.TaskExecutor taskExecutor) Deprecated, for removal: This API element is subject to removal in a future version.Set the TaskExecutor.
-
Field Details
-
logger
protected static final org.apache.commons.logging.Log loggerDeprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
SimpleJobLauncher
public SimpleJobLauncher()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
run
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException Deprecated, for removal: This API element is subject to removal in a future version.Run the provided job with the givenJobParameters
. TheJobParameters
will be used to determine if this is an execution of an existing job instance, or if a new one should be created.- Specified by:
run
in interfaceJobLauncher
- Parameters:
job
- the job to be run.jobParameters
- theJobParameters
for this particular execution.- Returns:
- the
JobExecution
if it returns synchronously. If the implementation is asynchronous, the status might well be unknown. - Throws:
JobExecutionAlreadyRunningException
- if the JobInstance already exists and has an execution already running.JobRestartException
- if the execution would be a re-start, but a re-start is either not allowed or not needed.JobInstanceAlreadyCompleteException
- if this instance has already completed successfullyJobParametersInvalidException
- thrown if jobParameters is invalid.
-
setJobRepository
Deprecated, for removal: This API element is subject to removal in a future version.Set the JobRepository.- Parameters:
jobRepository
- instance ofJobRepository
.
-
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Deprecated, for removal: This API element is subject to removal in a future version.Set the TaskExecutor. (Optional)- Parameters:
taskExecutor
- instance ofTaskExecutor
.
-
setMeterRegistry
public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Deprecated, for removal: This API element is subject to removal in a future version.Set the meter registry to use for metrics. Defaults toMetrics.globalRegistry
.- Parameters:
meterRegistry
- the meter registry- Since:
- 5.0
-
afterPropertiesSet
Deprecated, for removal: This API element is subject to removal in a future version.Ensure the required dependencies of aJobRepository
have been set.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
TaskExecutorJobLauncher
.