if(executionContext.containsKey("batch.lastSteps")) {
List<String> stepNames = (List<String>) executionContext.get("batch.lastSteps");
for (String stepName : stepNames) {
StepExecution curStepExecution = getJobRepository().getLastStepExecution(stepExecution.getJobExecution().getJobInstance(), stepName);
stepExecutions.add(new JsrStepExecution(curStepExecution));
}
} else {
Collection<StepExecution> currentRunStepExecutions = stepExecution.getJobExecution().getStepExecutions();
StepExecution lastExecution = null;
if(stepExecutions != null) {
for (StepExecution curStepExecution : currentRunStepExecutions) {
if(lastExecution == null || (curStepExecution.getEndTime() != null && curStepExecution.getEndTime().after(lastExecution.getEndTime()))) {
lastExecution = curStepExecution;
}
}
stepExecutions.add(new JsrStepExecution(lastExecution));
}
}
try {
ExitStatus exitStatus = new ExitStatus(decider.decide(stepExecutions.toArray(new javax.batch.runtime.StepExecution[0])));