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:
dsyer
2008-03-28 12:14:45 +00:00
parent bfa98e3bdb
commit 0ada1fcaaa
4 changed files with 47 additions and 5 deletions

View File

@@ -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);