org.springframework.batch.core.step.item
Class SimpleRetryExceptionHandler

java.lang.Object
  extended by org.springframework.batch.retry.listener.RetryListenerSupport
      extended by org.springframework.batch.core.step.item.SimpleRetryExceptionHandler
All Implemented Interfaces:
org.springframework.batch.repeat.exception.ExceptionHandler, org.springframework.batch.retry.RetryListener

public class SimpleRetryExceptionHandler
extends org.springframework.batch.retry.listener.RetryListenerSupport
implements org.springframework.batch.repeat.exception.ExceptionHandler

An 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.

Author:
Dave Syer

Constructor Summary
SimpleRetryExceptionHandler(org.springframework.batch.retry.RetryPolicy retryPolicy, org.springframework.batch.repeat.exception.ExceptionHandler exceptionHandler, java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
          Create an exception handler from its mandatory properties.
 
Method Summary
<T> void
close(org.springframework.batch.retry.RetryContext context, org.springframework.batch.retry.RetryCallback<T> callback, java.lang.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(org.springframework.batch.repeat.RepeatContext context, java.lang.Throwable throwable)
          Check if the exception is going to be retried, and veto the handling if it is.
 
Methods inherited from class org.springframework.batch.retry.listener.RetryListenerSupport
onError, open
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleRetryExceptionHandler

public SimpleRetryExceptionHandler(org.springframework.batch.retry.RetryPolicy retryPolicy,
                                   org.springframework.batch.repeat.exception.ExceptionHandler exceptionHandler,
                                   java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
Create an exception handler from its mandatory properties.

Parameters:
retryPolicy - the retry policy that will be under effect when an exception is encountered
exceptionHandler - the delegate to use if an exception actually needs to be handled
fatalExceptionClasses -
Method Detail

handleException

public void handleException(org.springframework.batch.repeat.RepeatContext context,
                            java.lang.Throwable throwable)
                     throws java.lang.Throwable
Check if the exception is going to be retried, and veto the handling if it is. If retry is exhausted or the exception is on the fatal list, then handle using the delegate.

Specified by:
handleException in interface org.springframework.batch.repeat.exception.ExceptionHandler
Throws:
java.lang.Throwable
See Also:
ExceptionHandler.handleException(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)

close

public <T> void close(org.springframework.batch.retry.RetryContext context,
                      org.springframework.batch.retry.RetryCallback<T> callback,
                      java.lang.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.

Specified by:
close in interface org.springframework.batch.retry.RetryListener
Overrides:
close in class org.springframework.batch.retry.listener.RetryListenerSupport
See Also:
RetryListener.close(org.springframework.batch.retry.RetryContext, org.springframework.batch.retry.RetryCallback, java.lang.Throwable)


Copyright © 2009. All Rights Reserved.