类 SimpleJobLauncher
- java.lang.Object
- org.springframework.batch.core.launch.support.SimpleJobLauncher
- 所有已实现的接口:
JobLauncher
,org.springframework.beans.factory.InitializingBean
public class SimpleJobLauncher extends java.lang.Object implements JobLauncher, org.springframework.beans.factory.InitializingBean
Simple implementation of theJobLauncher
interface. The Spring CoreTaskExecutor
interface is used to launch aJob
. This means that the type of executor set is very important. If aSyncTaskExecutor
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, aJobRepository
. The JobRepository is used to obtain a valid JobExecution. The Repository must be used because the providedJob
could be a restart of an existingJobInstance
, and only the Repository can reliably recreate it.- 从以下版本开始:
- 1.0
- 作者:
- Lucas Ward, Dave Syer, Will Schipp, Michael Minella, Mahmoud Ben Hassine
- 另请参阅:
JobRepository
,TaskExecutor
字段概要
字段 修饰符和类型 字段 说明 protected static org.apache.commons.logging.Log
logger
构造器概要
构造器 构造器 说明 SimpleJobLauncher()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Ensure the required dependencies of aJobRepository
have been set.JobExecution
run(Job job, JobParameters jobParameters)
Run the provided job with the givenJobParameters
.void
setJobRepository(JobRepository jobRepository)
Set the JobRepository.void
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Set the TaskExecutor.
字段详细资料
logger
protected static final org.apache.commons.logging.Log logger
构造器详细资料
SimpleJobLauncher
public SimpleJobLauncher()
方法详细资料
run
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException
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.- 指定者:
run
在接口中JobLauncher
- 参数:
job
- the job to be run.jobParameters
- theJobParameters
for this particular execution.- 返回:
- the
JobExecution
if it returns synchronously. If the implementation is asynchronous, the status might well be unknown. - 抛出:
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
public void setJobRepository(JobRepository jobRepository)
Set the JobRepository.- 参数:
jobRepository
- instance ofJobRepository
.
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
Set the TaskExecutor. (Optional)- 参数:
taskExecutor
- instance ofTaskExecutor
.
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Ensure the required dependencies of aJobRepository
have been set.- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception