Reputation: 590
I am looking for default values Spring Batch Framework adds the jobs "BatchStatus" values based on the "EXITSTATUS" (Looking for defalut values framework adds). I have tried to look some of the source code of the spring batch framework class files i didn't find.Can some one please post the class name where i can find the default logic in framework source code.
For Example When (Simulation code )
if(EXITSTATUS is FAILED)
{
jobs.setBatchStatus(FAILED)
}
Upvotes: 0
Views: 656
Reputation: 2658
1. Default Exit Status is UNKNOWN and Default Status is STARTING
(org.springframework.batch.core.JobExecution)
private volatile BatchStatus status = BatchStatus.STARTING;
private volatile ExitStatus exitStatus = ExitStatus.UNKNOWN;
2. First time run is STARTED as
org.springframework.batch.core.job.AbstractJob
if (execution.getStatus() != BatchStatus.STOPPING) {
execution.setStartTime(new Date());
updateStatus(execution, BatchStatus.STARTED);
3. If your job is based on SimpleJob so
Job Status is updated based on Step Execution's Status (Note: they will apply upgrade status ) and
Job Exit Status is updated base on Step Execution's Exit Status
org.springframework.batch.core.job.SimpleJob
if (stepExecution != null) {
logger.debug("Upgrading JobExecution status: " + stepExecution);
execution.upgradeStatus(stepExecution.getStatus());
execution.setExitStatus(stepExecution.getExitStatus());
}
4. If your job is based on FlowJob, Status and ExitStatus is updated based on the method
org.springframework.batch.core.job.flow.JobFlowExecutor
public void updateJobExecutionStatus(FlowExecutionStatus status) {
execution.setStatus(findBatchStatus(status));
exitStatus = exitStatus.and(new ExitStatus(status.getName()));
execution.setExitStatus(exitStatus);
}
We are seeing Status and Exit Status are updating separately and no logic Spring set Status based on Exit Status. They are based on StepExecutionStatus or FlowExecutionStatus.
Upvotes: 2