Class RetryListenerSupport

java.lang.Object
org.springframework.retry.listener.RetryListenerSupport
All Implemented Interfaces:
RetryListener
Direct Known Subclasses:
StatisticsListener

public class RetryListenerSupport extends Object implements RetryListener
Empty method implementation of RetryListener.
Author:
Dave Syer
  • Constructor Details

    • RetryListenerSupport

      public RetryListenerSupport()
  • Method Details

    • close

      public <T, E extends Throwable> void close(RetryContext context, RetryCallback<T,E> callback, Throwable throwable)
      Description copied from interface: RetryListener
      Called after the final attempt (successful or not). Allow the listener to clean up any resource it is holding before control returns to the retry caller.
      Specified by:
      close in interface RetryListener
      Type Parameters:
      T - the return value
      E - the exception type
      Parameters:
      context - the current RetryContext.
      callback - the current RetryCallback.
      throwable - the last exception that was thrown by the callback.
    • onError

      public <T, E extends Throwable> void onError(RetryContext context, RetryCallback<T,E> callback, Throwable throwable)
      Description copied from interface: RetryListener
      Called after every unsuccessful attempt at a retry.
      Specified by:
      onError in interface RetryListener
      Type Parameters:
      T - the return value
      E - the exception to throw
      Parameters:
      context - the current RetryContext.
      callback - the current RetryCallback.
      throwable - the last exception that was thrown by the callback.
    • open

      public <T, E extends Throwable> boolean open(RetryContext context, RetryCallback<T,E> callback)
      Description copied from interface: RetryListener
      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.
      Specified by:
      open in interface RetryListener
      Type Parameters:
      T - the type of object returned by the callback
      E - the type of exception it declares may be thrown
      Parameters:
      context - the current RetryContext.
      callback - the current RetryCallback.
      Returns:
      true if the retry should proceed.