diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/RetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/RetryPolicy.java index ffbbcba15..f6514cc91 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/RetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/RetryPolicy.java @@ -58,9 +58,7 @@ public interface RetryPolicy { * * @param context the current status object. * - * @throws TerminatedRetryException if the status is set to terminate only. - * */ - void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException; + void registerThrowable(RetryContext context, Exception throwable); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/CompositeRetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/CompositeRetryPolicy.java index 18d180659..0ebbd11c1 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/CompositeRetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/CompositeRetryPolicy.java @@ -21,7 +21,6 @@ import java.util.List; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryPolicy; -import org.springframework.batch.retry.TerminatedRetryException; import org.springframework.batch.retry.context.RetryContextSupport; /** @@ -108,7 +107,7 @@ public class CompositeRetryPolicy implements RetryPolicy { * * @see org.springframework.batch.retry.RetryPolicy#close(org.springframework.batch.retry.RetryContext, boolean) */ - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { RetryContext[] contexts = ((CompositeRetryContext) context).contexts; RetryPolicy[] policies = ((CompositeRetryContext) context).policies; for (int i = 0; i < contexts.length; i++) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ExceptionClassifierRetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ExceptionClassifierRetryPolicy.java index bd7fca922..6f79d62cf 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ExceptionClassifierRetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/ExceptionClassifierRetryPolicy.java @@ -21,7 +21,6 @@ import java.util.Map; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryPolicy; -import org.springframework.batch.retry.TerminatedRetryException; import org.springframework.batch.retry.context.RetryContextSupport; import org.springframework.batch.support.Classifier; import org.springframework.batch.support.ExceptionClassifierSupport; @@ -103,7 +102,7 @@ public class ExceptionClassifierRetryPolicy implements RetryPolicy { * @see org.springframework.batch.retry.RetryPolicy#registerThrowable(org.springframework.batch.retry.RetryContext, * Exception) */ - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { RetryPolicy policy = (RetryPolicy) context; policy.registerThrowable(context, throwable); ((RetryContextSupport) context).registerThrowable(throwable); @@ -148,7 +147,7 @@ public class ExceptionClassifierRetryPolicy implements RetryPolicy { return this; } - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { policy = getPolicy(exceptionClassifier.classify(throwable)); this.context = getContext(policy); policy.registerThrowable(this.context, throwable); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/NeverRetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/NeverRetryPolicy.java index b2bc02d6a..af8cc565b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/NeverRetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/NeverRetryPolicy.java @@ -18,7 +18,6 @@ package org.springframework.batch.retry.policy; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryPolicy; -import org.springframework.batch.retry.TerminatedRetryException; import org.springframework.batch.retry.context.RetryContextSupport; /** @@ -65,7 +64,7 @@ public class NeverRetryPolicy implements RetryPolicy { * @see org.springframework.batch.retry.RetryPolicy#registerThrowable(org.springframework.batch.retry.RetryContext, * Exception) */ - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { ((NeverRetryContext) context).setFinished(); ((RetryContextSupport) context).registerThrowable(throwable); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/TimeoutRetryPolicy.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/TimeoutRetryPolicy.java index 8673c62d5..389667804 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/TimeoutRetryPolicy.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/policy/TimeoutRetryPolicy.java @@ -18,7 +18,6 @@ package org.springframework.batch.retry.policy; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryPolicy; -import org.springframework.batch.retry.TerminatedRetryException; import org.springframework.batch.retry.context.RetryContextSupport; /** @@ -62,7 +61,7 @@ public class TimeoutRetryPolicy implements RetryPolicy { return new TimeoutRetryContext(parent, timeout); } - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { ((RetryContextSupport) context).registerThrowable(throwable); // otherwise no-op - we only time out, otherwise retry everything... } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java index c384a3a1c..a6f422578 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/retry/support/RetryTemplate.java @@ -133,7 +133,7 @@ public class RetryTemplate implements RetryOperations { * @see org.springframework.batch.retry.RetryOperations#execute(org.springframework.batch.retry.RetryCallback) * * @throws TerminatedRetryException if the retry has been manually - * terminated through the {@link RetryContext}. + * terminated by a listener. */ public final T execute(RetryCallback retryCallback) throws Exception { return doExecute(retryCallback, null, null); @@ -148,7 +148,7 @@ public class RetryTemplate implements RetryOperations { * org.springframework.batch.retry.RecoveryCallback) * * @throws TerminatedRetryException if the retry has been manually - * terminated through the {@link RetryContext}. + * terminated by a listener. */ public final T execute(RetryCallback retryCallback, RecoveryCallback recoveryCallback) throws Exception { return doExecute(retryCallback, recoveryCallback, null); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/policy/CompositeRetryPolicyTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/policy/CompositeRetryPolicyTests.java index 46ca1bdd0..579700a8a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/policy/CompositeRetryPolicyTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/retry/policy/CompositeRetryPolicyTests.java @@ -23,7 +23,6 @@ import junit.framework.TestCase; import org.springframework.batch.retry.RetryContext; import org.springframework.batch.retry.RetryPolicy; -import org.springframework.batch.retry.TerminatedRetryException; public class CompositeRetryPolicyTests extends TestCase { @@ -63,7 +62,7 @@ public class CompositeRetryPolicyTests extends TestCase { return !errorRegistered; } - public void registerThrowable(RetryContext context, Exception throwable) throws TerminatedRetryException { + public void registerThrowable(RetryContext context, Exception throwable) { errorRegistered = true; } } });