org.springframework.batch.retry
Interface RetryListener

All Known Implementing Classes:
RetryListenerSupport, SimpleRetryExceptionHandler

public interface RetryListener

Interface for listener that can be used to add behaviour to a retry. Implementations of RetryOperations can chose to issue callbacks to an interceptor during the retry lifecycle.

Author:
Dave Syer

Method Summary
 void close(RetryContext context, RetryCallback callback, Throwable throwable)
          Called after the final attempt (successful or not).
 void onError(RetryContext context, RetryCallback callback, Throwable throwable)
          Called after every unsuccessful attempt at a retry.
 boolean open(RetryContext context, RetryCallback callback)
          Called before the first attempt in a retry.
 

Method Detail

open

boolean open(RetryContext context,
             RetryCallback callback)
Called before the first attempt in a retry. For instance, implementers can set up state that is needed by the policies in the RetryOperations. The whole retry can be vetoed by returning false from this method, in which case a TerminatedRetryException will be thrown.

Parameters:
context - the current RetryContext.
callback - the current RetryCallback.
Returns:
true if the retry should proceed.

close

void close(RetryContext context,
           RetryCallback callback,
           Throwable throwable)
Called after the final attempt (successful or not). Allow the interceptor to clean up any resource it is holding before control returns to the retry caller.

Parameters:
context - the current RetryContext.
callback - the current RetryCallback.
throwable - the last exception that was thrown by the callback.

onError

void onError(RetryContext context,
             RetryCallback callback,
             Throwable throwable)
Called after every unsuccessful attempt at a retry.

Parameters:
context - the current RetryContext.
callback - the current RetryCallback.
throwable - the last exception that was thrown by the callback.


Copyright © 2009 SpringSource. All Rights Reserved.