From a30840693e3a974b474ec5ca4d1d59f82e5b308c Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Thu, 19 Sep 2013 14:55:56 -0500 Subject: [PATCH] Updated retry logic for a JSR configured processor --- .../jsr/step/item/JsrFaultTolerantChunkProcessor.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java index 35b283d4c..585e65f30 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/step/item/JsrFaultTolerantChunkProcessor.java @@ -26,7 +26,6 @@ import org.springframework.batch.core.step.item.Chunk; import org.springframework.batch.core.step.item.ChunkMonitor; import org.springframework.batch.core.step.item.ForceRollbackForWriteSkipException; import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy; -import org.springframework.batch.core.step.skip.NonSkippableProcessException; import org.springframework.batch.core.step.skip.SkipException; import org.springframework.batch.core.step.skip.SkipPolicy; import org.springframework.batch.core.step.skip.SkipPolicyFailedException; @@ -225,6 +224,7 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor return doTransform(item); } catch (Exception e) { + System.err.println("e has been thrown in the transform: " + e.getClass() + " and the skip count = " + contribution.getStepSkipCount() + " and should we skip it? " + skipPolicy.shouldSkip(e, contribution.getStepSkipCount())); if (rollbackClassifier.classify(e)) { // Default is to rollback unless the classifier // allows us to continue @@ -240,12 +240,7 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor getListener().onSkipInProcess(item, e); } else { - // If it's not skippable that's an error in - // configuration - it doesn't make sense to not roll - // back if we are also not allowed to skip - throw new NonSkippableProcessException( - "Non-skippable exception in processor. Make sure any exceptions that do not cause a rollback are skippable.", - e); + throw e; } } return null; @@ -258,6 +253,7 @@ public class JsrFaultTolerantChunkProcessor extends JsrChunkProcessor @Override public O recover(RetryContext context) throws Exception { Throwable e = context.getLastThrowable(); + System.err.println("e = " + e.getClass() + " skipCount = " + contribution.getStepSkipCount()); if (shouldSkip(skipPolicy, e, contribution.getStepSkipCount())) { contribution.incrementProcessSkipCount(); logger.debug("Skipping after failed process", e);