From bdda948e1ac57376a910c8d14b543b11c4c50191 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 14 Nov 2016 09:22:57 +0000 Subject: [PATCH] Correct README with usage for setting retryable exceptions --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d7aa267..b32a2d2 100644 --- a/README.md +++ b/README.md @@ -152,16 +152,13 @@ Failures are inherently either retryable or not - if the same exception is alway Spring Retry provides some simple general purpose implementations of stateless RetryPolicy, for example a `SimpleRetryPolicy`, and the `TimeoutRetryPolicy` used in the example above. -The `SimpleRetryPolicy` just allows a retry on any of a named list of exception types, up to a fixed number of times. It also has a list of "fatal" exceptions that should never be retried, and this list overrides the retryable list so that it can be used to give finer control over the retry behavior: +The `SimpleRetryPolicy` just allows a retry on any of a named list of exception types, up to a fixed number of times: ```java -SimpleRetryPolicy policy = new SimpleRetryPolicy(); // Set the max attempts including the initial attempt before retrying -policy.setMaxAttempts(5); -// Retry on all exceptions (this is the default) +// and retry on all exceptions (this is the default): +SimpleRetryPolicy policy = new SimpleRetryPolicy(5, Collections.singletonMap(Exception.class, true)); policy.setRetryableExceptions(new Class[] {Exception.class}); -// ... but never retry IllegalStateException -policy.setFatalExceptions(new Class[] {IllegalStateException.class}); // Use the policy... RetryTemplate template = new RetryTemplate();