RESOLVED - BATCH-847: FaultTolerantChunkOrientedTasklet loses chunks when non-skippable exceptions thrown in read phase
used fatal NonSkippableReadException instead of reusing SkipLimitExceededException
This commit is contained in:
@@ -20,7 +20,7 @@ import java.util.Collections;
|
||||
import org.springframework.batch.core.SkipListener;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.skip.ItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
|
||||
import org.springframework.batch.core.step.skip.NonSkippableReadException;
|
||||
import org.springframework.batch.core.step.skip.SkipListenerFailedException;
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
@@ -185,9 +185,7 @@ public class FaultTolerantChunkOrientedTasklet<T, S> extends AbstractItemOriente
|
||||
logger.debug("Skipping failed input", e);
|
||||
}
|
||||
else {
|
||||
// skip doesn't apply -> rethrow as if skip limit of zero
|
||||
// was exceeded
|
||||
throw new SkipLimitExceededException(0, e);
|
||||
throw new NonSkippableReadException("Non-skippable exception during read", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.step.skip.ItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy;
|
||||
import org.springframework.batch.core.step.skip.NonSkippableReadException;
|
||||
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
|
||||
import org.springframework.batch.core.step.skip.SkipListenerFailedException;
|
||||
import org.springframework.batch.core.step.tasklet.TaskletStep;
|
||||
@@ -194,6 +195,7 @@ public class SkipLimitStepFactoryBean<T, S> extends SimpleStepFactoryBean<T, S>
|
||||
if (retryLimit > 0 || skipLimit > 0 || retryPolicy != null) {
|
||||
|
||||
addFatalExceptionIfMissing(SkipLimitExceededException.class);
|
||||
addFatalExceptionIfMissing(NonSkippableReadException.class);
|
||||
addFatalExceptionIfMissing(SkipListenerFailedException.class);
|
||||
addFatalExceptionIfMissing(RetryException.class);
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.springframework.batch.core.step.skip;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
|
||||
public class NonSkippableReadException extends NestedRuntimeException {
|
||||
|
||||
public NonSkippableReadException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user