类 SimpleStepHandler
- java.lang.Object
- org.springframework.batch.core.job.SimpleStepHandler
- 所有已实现的接口:
StepHandler
,org.springframework.beans.factory.InitializingBean
- 直接已知子类:
JsrStepHandler
public class SimpleStepHandler extends java.lang.Object implements StepHandler, org.springframework.beans.factory.InitializingBean
Implementation ofStepHandler
that manages repository and restart concerns.- 作者:
- Dave Syer
构造器概要
构造器 构造器 说明 SimpleStepHandler()
Convenient default constructor for configuration usage.SimpleStepHandler(JobRepository jobRepository)
SimpleStepHandler(JobRepository jobRepository, ExecutionContext executionContext)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Check mandatory properties (jobRepository).protected JobRepository
getJobRepository()
StepExecution
handleStep(Step step, JobExecution execution)
Handle a step and return the execution for it.void
setExecutionContext(ExecutionContext executionContext)
A context containing values to be added to the step execution before it is handled.void
setJobRepository(JobRepository jobRepository)
protected boolean
shouldStart(StepExecution lastStepExecution, JobExecution jobExecution, Step step)
Given a step and configuration, return true if the step should start, false if it should not, and throw an exception if the job should finish.
构造器详细资料
SimpleStepHandler
public SimpleStepHandler()
Convenient default constructor for configuration usage.
SimpleStepHandler
public SimpleStepHandler(JobRepository jobRepository)
- 参数:
jobRepository
- aJobRepository
SimpleStepHandler
public SimpleStepHandler(JobRepository jobRepository, ExecutionContext executionContext)
- 参数:
jobRepository
- aJobRepository
executionContext
- theExecutionContext
for the current Step
方法详细资料
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Check mandatory properties (jobRepository).- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
- 另请参阅:
InitializingBean.afterPropertiesSet()
getJobRepository
protected JobRepository getJobRepository()
- 返回:
- the used jobRepository
setJobRepository
public void setJobRepository(JobRepository jobRepository)
- 参数:
jobRepository
- the jobRepository to set
setExecutionContext
public void setExecutionContext(ExecutionContext executionContext)
A context containing values to be added to the step execution before it is handled.- 参数:
executionContext
- the execution context to set
handleStep
public StepExecution handleStep(Step step, JobExecution execution) throws JobInterruptedException, JobRestartException, StartLimitExceededException
从接口复制的说明:StepHandler
Handle a step and return the execution for it. Does not save theJobExecution
, but should manage the persistence of theStepExecution
if required (e.g. at least it needs to be added to a repository before the step can be executed).- 指定者:
handleStep
在接口中StepHandler
- 参数:
step
- aStep
execution
- aJobExecution
- 返回:
- an execution of the step
- 抛出:
JobInterruptedException
- if there is an interruptionJobRestartException
- if there is a problem restarting a failed stepStartLimitExceededException
- if the step exceeds its start limit- 另请参阅:
Job.execute(JobExecution)
,Step.execute(StepExecution)
shouldStart
protected boolean shouldStart(StepExecution lastStepExecution, JobExecution jobExecution, Step step) throws JobRestartException, StartLimitExceededException
Given a step and configuration, return true if the step should start, false if it should not, and throw an exception if the job should finish.- 参数:
lastStepExecution
- the last step executionjobExecution
- theJobExecution
instance to be evaluated.step
- theStep
instance to be evaluated.- 返回:
- true if step should start, false if it should not.
- 抛出:
StartLimitExceededException
- if the start limit has been exceeded for this stepJobRestartException
- if the job is in an inconsistent state from an earlier failure