RESOLVED - issue BATCH-486: Users must choose between skip and retry
Tweak the retry policy to account for fatal exceptions as well (they should not be retryable).
This commit is contained in:
@@ -82,6 +82,24 @@ public class SimpleRetryPolicyTests extends TestCase {
|
||||
assertEquals("foo", context.getLastThrowable().getMessage());
|
||||
}
|
||||
|
||||
public void testDefaultFatal() throws Exception {
|
||||
SimpleRetryPolicy policy = new SimpleRetryPolicy();
|
||||
RetryContext context = policy.open(null, null);
|
||||
assertNotNull(context);
|
||||
policy.registerThrowable(context, new Error("foo"));
|
||||
assertFalse(policy.canRetry(context));
|
||||
}
|
||||
|
||||
public void testFatalOverridesRetryable() throws Exception {
|
||||
SimpleRetryPolicy policy = new SimpleRetryPolicy();
|
||||
policy.setFatalExceptionClasses(new Class[] {Exception.class});
|
||||
policy.setRetryableExceptionClasses(new Class[] {RuntimeException.class});
|
||||
RetryContext context = policy.open(null, null);
|
||||
assertNotNull(context);
|
||||
policy.registerThrowable(context, new RuntimeException("foo"));
|
||||
assertFalse(policy.canRetry(context));
|
||||
}
|
||||
|
||||
public void testParent() throws Exception {
|
||||
SimpleRetryPolicy policy = new SimpleRetryPolicy();
|
||||
RetryContext context = policy.open(null, null);
|
||||
|
||||
Reference in New Issue
Block a user