in jbatch/src/main/java/org/apache/batchee/container/impl/controller/chunk/ChunkStepController.java [867:918]
private void openReaderAndWriter() {
readerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), CheckpointType.READER);
CheckpointData readerChkptData = persistenceManagerService.getCheckpointData(readerChkptDK);
try {
// check for data in backing store
if (readerChkptData != null) {
final byte[] readertoken = readerChkptData.getRestartToken();
try {
readerProxy.open((Serializable) dataRepresentationService.toJavaRepresentation(readertoken));
} catch (final Exception ex) {
// is this what I should be throwing here?
throw new BatchContainerServiceException("Cannot read the checkpoint data for [" + step.getId() + "]", ex);
}
} else {
// no chkpt data exists in the backing store
readerChkptData = null;
try {
readerProxy.open(null);
} catch (final Exception ex) {
// is this what I should be throwing here?
throw new BatchContainerServiceException("Exception while opening step [" + step.getId() + "]", ex);
}
}
} catch (final ClassCastException e) {
throw new IllegalStateException("Expected CheckpointData but found" + readerChkptData);
}
writerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), CheckpointType.WRITER);
CheckpointData writerChkptData = persistenceManagerService.getCheckpointData(writerChkptDK);
try {
// check for data in backing store
if (writerChkptData != null) {
final byte[] writertoken = writerChkptData.getRestartToken();
try {
writerProxy.open((Serializable) dataRepresentationService.toJavaRepresentation(writertoken));
} catch (final Exception ex) {
throw new BatchContainerServiceException("Cannot persist the checkpoint data for [" + step.getId() + "]", ex);
}
} else {
// no chkpt data exists in the backing store
writerChkptData = null;
try {
writerProxy.open(null);
} catch (Exception e) {
ExceptionConfig.wrapBatchException(e);
}
}
} catch (final ClassCastException e) {
throw new IllegalStateException("Expected Checkpoint but found" + writerChkptData);
}
}