public class SimpleRetryExceptionHandler extends RetryListenerSupport implements ExceptionHandler
ExceptionHandler that is aware of the retry context so that it can
distinguish between a fatal exception and one that can be retried. Delegates
the actual exception handling to another ExceptionHandler.| Constructor and Description |
|---|
SimpleRetryExceptionHandler(RetryPolicy retryPolicy,
ExceptionHandler exceptionHandler,
Collection<Class<? extends Throwable>> fatalExceptionClasses)
Create an exception handler from its mandatory properties.
|
| Modifier and Type | Method and Description |
|---|---|
<T> void |
close(RetryContext context,
RetryCallback<T> callback,
Throwable throwable)
If retry is exhausted set up some state in the context that can be used
to signal that the exception should be handled.
|
void |
handleException(RepeatContext context,
Throwable throwable)
Check if the exception is going to be retried, and veto the handling if
it is.
|
onError, openpublic SimpleRetryExceptionHandler(RetryPolicy retryPolicy, ExceptionHandler exceptionHandler, Collection<Class<? extends Throwable>> fatalExceptionClasses)
retryPolicy - the retry policy that will be under effect when an
exception is encounteredexceptionHandler - the delegate to use if an exception actually
needs to be handledfatalExceptionClasses - public void handleException(RepeatContext context, Throwable throwable) throws Throwable
handleException in interface ExceptionHandlercontext - the current RepeatContext. Can be used to store
state (via attributes), for example to count the number of occurrences of
a particular exception type and implement a threshold policy.throwable - an exception.Throwable - implementations are free to re-throw the exceptionExceptionHandler.handleException(org.springframework.batch.repeat.RepeatContext,
java.lang.Throwable)public <T> void close(RetryContext context, RetryCallback<T> callback, Throwable throwable)
close in interface RetryListenerclose in class RetryListenerSupportcontext - the current RetryContext.callback - the current RetryCallback.throwable - the last exception that was thrown by the callback.RetryListener.close(org.springframework.batch.retry.RetryContext,
org.springframework.batch.retry.RetryCallback, java.lang.Throwable)Copyright © 2014 SpringSource. All rights reserved.