IN PROGRESS - issue BATCH-894: RFC: move ExitStatus up into Core?

Remove continuable from ExitStatus
This commit is contained in:
dsyer
2008-11-08 15:08:56 +00:00
parent 16606e3abd
commit 8eb244b49a
14 changed files with 185 additions and 229 deletions

View File

@@ -157,9 +157,8 @@ public class ChunkMessageChannelItemWriter<T> extends StepExecutionListenerSuppo
+ jobInstanceId + "] should have been [" + localState.getJobId() + "].");
localState.actual++;
// TODO: apply the skip count
ExitStatus result = payload.getExitStatus();
// TODO: check it can never be ExitStatus.FINISHED?
if (!result.isContinuable()) {
BatchStatus result = payload.getStatus();
if (BatchStatus.COMPLETED!=result) {
throw new AsynchronousFailureException("Failure or early completion detected in handler: " + result);
}
}

View File

@@ -2,7 +2,7 @@ package org.springframework.batch.integration.chunk;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.BatchStatus;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
@@ -45,12 +45,11 @@ public class ChunkProcessorChunkHandler<S> implements ChunkHandler<S>, Initializ
}
catch (Exception e) {
logger.debug("Failed chunk", e);
return new ChunkResponse(ExitStatus.FAILED.addExitDescription(e.getClass().getName() + ": "
+ e.getMessage()), chunkRequest.getJobId(), skipCount);
return new ChunkResponse(BatchStatus.FAILED, chunkRequest.getJobId(), skipCount);
}
logger.debug("Completed chunk handling with " + skipCount + " skips");
return new ChunkResponse(ExitStatus.EXECUTING, chunkRequest.getJobId(), skipCount);
return new ChunkResponse(BatchStatus.COMPLETED, chunkRequest.getJobId(), skipCount);
}
}

View File

@@ -2,16 +2,16 @@ package org.springframework.batch.integration.chunk;
import java.io.Serializable;
import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.BatchStatus;
public class ChunkResponse implements Serializable {
private final int skipCount;
private final Long jobId;
private final ExitStatus exitStatus;
private final BatchStatus status;
public ChunkResponse(ExitStatus exitStatus, Long jobId, int skipCount) {
this.exitStatus = exitStatus;
public ChunkResponse(BatchStatus status, Long jobId, int skipCount) {
this.status = status;
this.jobId = jobId;
this.skipCount = skipCount;
}
@@ -24,8 +24,8 @@ public class ChunkResponse implements Serializable {
return jobId;
}
public ExitStatus getExitStatus() {
return exitStatus;
public BatchStatus getStatus() {
return status;
}
/**
@@ -33,7 +33,7 @@ public class ChunkResponse implements Serializable {
*/
@Override
public String toString() {
return getClass().getSimpleName()+": jobId="+jobId+", skipCount="+skipCount+", status="+exitStatus;
return getClass().getSimpleName()+": jobId="+jobId+", skipCount="+skipCount+", status="+status;
}
}