Class JsrStepHandler
- java.lang.Object
- org.springframework.batch.core.job.SimpleStepHandler
- org.springframework.batch.core.jsr.job.JsrStepHandler
- All Implemented Interfaces:
StepHandler
,org.springframework.beans.factory.InitializingBean
public class JsrStepHandler extends SimpleStepHandler
ExtendsSimpleStepHandler
to apply JSR-352 specific logic for whether to start a step.- Since:
- 3.0
- Author:
- Michael Minella
Constructor Summary
Constructors Constructor Description JsrStepHandler(JobRepository jobRepository, JobExplorer jobExplorer)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Check mandatory properties (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.Methods inherited from class org.springframework.batch.core.job.SimpleStepHandler
getJobRepository, handleStep, setExecutionContext, setJobRepository
Constructor Detail
JsrStepHandler
public JsrStepHandler(JobRepository jobRepository, JobExplorer jobExplorer)
- Parameters:
jobRepository
- instance ofJobRepository
.jobExplorer
- instance ofJobExplorer
.
Method Detail
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Description copied from class:SimpleStepHandler
Check mandatory properties (jobRepository).- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classSimpleStepHandler
- Throws:
java.lang.Exception
- See Also:
InitializingBean.afterPropertiesSet()
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.- Overrides:
shouldStart
in classSimpleStepHandler
- Parameters:
lastStepExecution
- the last step executionjobExecution
- instance ofJobExecution
step
- instance ofStep
- Returns:
- true if step should start, false if it should not.
- Throws:
StartLimitExceededException
- if the start limit has been exceeded for this stepJobRestartException
- if the job is in an inconsistent state from an earlier failure