Class JobFlowExecutor
java.lang.Object
org.springframework.batch.core.job.flow.JobFlowExecutor
- All Implemented Interfaces:
FlowExecutor
Implementation of
FlowExecutor for use in components that need to execute a
flow related to a JobExecution.- Author:
- Dave Syer, Michael Minella, Mahmoud Ben Hassine
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJobFlowExecutor(JobRepository jobRepository, StepHandler stepHandler, JobExecution execution) -
Method Summary
Modifier and TypeMethodDescriptionvoidHandle any status changes that might be needed at the start of a state.voidaddExitStatus(String code) voidclose(FlowExecution result) Chance to clean up resources at the end of a flow (whether it completed successfully or not).executeStep(Step step) protected BatchStatusfindBatchStatus(FlowExecutionStatus status) booleanvoidHandle any status changes that might be needed in theJobExecution.
-
Field Details
-
exitStatus
-
-
Constructor Details
-
JobFlowExecutor
public JobFlowExecutor(JobRepository jobRepository, StepHandler stepHandler, JobExecution execution) - Parameters:
jobRepository- instance ofJobRepository.stepHandler- instance ofStepHandler.execution- instance ofJobExecution.
-
-
Method Details
-
executeStep
public String executeStep(Step step) throws JobInterruptedException, JobRestartException, StartLimitExceededException - Specified by:
executeStepin interfaceFlowExecutor- Parameters:
step- aStepto execute- Returns:
- the exit status that drives the surrounding
Flow - Throws:
JobInterruptedException- thrown if job was interrupted.JobRestartException- thrown if job restart is not allowed.StartLimitExceededException- thrown if start limit is exceeded.
-
abandonStepExecution
public void abandonStepExecution()Description copied from interface:FlowExecutorHandle any status changes that might be needed at the start of a state.- Specified by:
abandonStepExecutionin interfaceFlowExecutor
-
updateJobExecutionStatus
Description copied from interface:FlowExecutorHandle any status changes that might be needed in theJobExecution.- Specified by:
updateJobExecutionStatusin interfaceFlowExecutor- Parameters:
status- status to update theJobExecutionto.
-
getJobExecution
- Specified by:
getJobExecutionin interfaceFlowExecutor- Returns:
- the current
JobExecution
-
getStepExecution
- Specified by:
getStepExecutionin interfaceFlowExecutor- Returns:
- the latest
StepExecutionor null if there is none
-
close
Description copied from interface:FlowExecutorChance to clean up resources at the end of a flow (whether it completed successfully or not).- Specified by:
closein interfaceFlowExecutor- Parameters:
result- the finalFlowExecution
-
isRestart
public boolean isRestart()- Specified by:
isRestartin interfaceFlowExecutor- Returns:
- true if the flow is at the beginning of a restart
-
addExitStatus
- Specified by:
addExitStatusin interfaceFlowExecutor- Parameters:
code- the label for the exit status when a flow or sub-flow ends
-
findBatchStatus
- Parameters:
status-FlowExecutionStatusto convert.- Returns:
- A
BatchStatusappropriate for theFlowExecutionStatusprovided
-