BATCH-1011: Refactor BatchStatus again so that FAILED has the same meaning as before (1.1.x etc.) and ABANDONED is introduced to signify a step that failed but does not need to be replayed on restart (formerly known as INCOMPLETE).

This commit is contained in:
dsyer
2009-02-15 10:59:44 +00:00
parent fa56955f8d
commit 7533f90480
70 changed files with 696 additions and 427 deletions

View File

@@ -99,11 +99,11 @@ public class ChunkMessageChannelItemWriter<T> extends StepExecutionListenerSuppo
}
catch (RuntimeException e) {
logger.debug("Detected failure waiting for results in step listener.", e);
stepExecution.setStatus(BatchStatus.INCOMPLETE);
stepExecution.setStatus(BatchStatus.FAILED);
return ExitStatus.FAILED.addExitDescription(e.getClass().getName() + ": " + e.getMessage());
}
if (timedOut) {
stepExecution.setStatus(BatchStatus.INCOMPLETE);
stepExecution.setStatus(BatchStatus.FAILED);
throw new ItemStreamException("Timed out waiting for back log at end of step");
}
return ExitStatus.COMPLETED.addExitDescription("Waited for " + expecting + " results.");

View File

@@ -27,8 +27,8 @@ import org.springframework.batch.core.JobExecution;
* (generally a handler cannot determine if the whole job execution is complete,
* so this is just information about the step).<br/>
*
* If the incoming status is {@link BatchStatus#INCOMPLETE},
* {@link BatchStatus#FAILED} or {@link BatchStatus#STOPPING} the request
* If the incoming status is {@link BatchStatus#FAILED},
* {@link BatchStatus#ABANDONED} or {@link BatchStatus#STOPPING} the request
* should be ignored by handlers (passed on without modification).
*
* @author Dave Syer

View File

@@ -136,7 +136,7 @@ public class StepExecutionMessageHandler {
* @return
*/
private boolean isComplete(JobExecutionRequest request) {
return request.getStatus() == BatchStatus.INCOMPLETE || request.getStatus() == BatchStatus.FAILED
return request.getStatus() == BatchStatus.FAILED || request.getStatus() == BatchStatus.ABANDONED
|| request.getStatus() == BatchStatus.STOPPING;
}
@@ -146,7 +146,7 @@ public class StepExecutionMessageHandler {
*/
private void handleFailure(JobExecutionRequest request, Throwable e) {
request.registerThrowable(e);
request.setStatus(BatchStatus.INCOMPLETE);
request.setStatus(BatchStatus.FAILED);
}
/*