diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java index 2402ffee2..60136cb0c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/FaultTolerantStepFactoryBean.java @@ -67,22 +67,23 @@ import org.springframework.util.Assert; */ public class FaultTolerantStepFactoryBean extends SimpleStepFactoryBean { - private int skipLimit = 0; - private Collection> skippableExceptionClasses = new HashSet>(); private Collection> fatalExceptionClasses = new HashSet>(); + private Collection> retryableExceptionClasses = new HashSet>(); + { fatalExceptionClasses.add(Error.class); skippableExceptionClasses.add(Exception.class); + retryableExceptionClasses.add(Exception.class); } private int cacheCapacity = 0; private int retryLimit = 1; - private Collection> retryableExceptionClasses = new HashSet>(); + private int skipLimit = 0; private BackOffPolicy backOffPolicy; @@ -225,33 +226,14 @@ public class FaultTolerantStepFactoryBean extends SimpleStepFactoryBean() { - - public RetryPolicy classify(Throwable classifiable) { - - for (Class fatal : fatalExceptionClasses) { - if (fatal.isAssignableFrom(classifiable.getClass())) { - return neverRetryPolicy; - } - } - return retryPolicy; - } - }); + + RetryPolicy retryPolicyWrapper = fatalExceptionAwareProxy(retryPolicy); + BatchRetryTemplate batchRetryTemplate = new BatchRetryTemplate(); if (backOffPolicy != null) { batchRetryTemplate.setBackOffPolicy(backOffPolicy); @@ -313,6 +295,30 @@ public class FaultTolerantStepFactoryBean extends SimpleStepFactoryBean() { + + public RetryPolicy classify(Throwable classifiable) { + + for (Class fatal : fatalExceptionClasses) { + if (fatal.isAssignableFrom(classifiable.getClass())) { + return neverRetryPolicy; + } + } + return retryPolicy; + } + }); + return retryPolicyWrapper; + } + /** * Register injected item listeners. */ @@ -332,7 +338,8 @@ public class FaultTolerantStepFactoryBean extends SimpleStepFactoryBean chunkProvider, SimpleChunkProcessor chunkProcessor) {