Interface RetryListener
- All Known Implementing Classes:
CompositeRetryListener
public interface RetryListener
RetryListener defines a listener API for reacting to events
published during the execution of a Retryable operation.
Typically registered in a RetryTemplate, and can be composed using a
CompositeRetryListener.
- Since:
- 7.0
- Author:
- Mahmoud Ben Hassine, Sam Brannen, Juergen Hoeller
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbeforeRetry(RetryPolicy retryPolicy, Retryable<?> retryable) Called before every retry attempt.default voidonRetryFailure(RetryPolicy retryPolicy, Retryable<?> retryable, Throwable throwable) Called after every failed retry attempt.default voidonRetryPolicyExhaustion(RetryPolicy retryPolicy, Retryable<?> retryable, RetryException exception) Called if theRetryPolicyis exhausted.default voidonRetryPolicyInterruption(RetryPolicy retryPolicy, Retryable<?> retryable, RetryException exception) Called if theRetryPolicyis interrupted between retry attempts.default voidonRetrySuccess(RetryPolicy retryPolicy, Retryable<?> retryable, @Nullable Object result) Called after the first successful retry attempt.
-
Method Details
-
beforeRetry
Called before every retry attempt.- Parameters:
retryPolicy- theRetryPolicyretryable- theRetryableoperation
-
onRetrySuccess
default void onRetrySuccess(RetryPolicy retryPolicy, Retryable<?> retryable, @Nullable Object result) Called after the first successful retry attempt.- Parameters:
retryPolicy- theRetryPolicyretryable- theRetryableoperationresult- the result of theRetryableoperation
-
onRetryFailure
Called after every failed retry attempt.- Parameters:
retryPolicy- theRetryPolicyretryable- theRetryableoperationthrowable- the exception thrown by theRetryableoperation
-
onRetryPolicyExhaustion
default void onRetryPolicyExhaustion(RetryPolicy retryPolicy, Retryable<?> retryable, RetryException exception) Called if theRetryPolicyis exhausted.- Parameters:
retryPolicy- theRetryPolicyretryable- theRetryableoperationexception- the resultingRetryException, with the last exception thrown by theRetryableoperation as the cause and any exceptions from previous attempts as suppressed exceptions- See Also:
-
onRetryPolicyInterruption
default void onRetryPolicyInterruption(RetryPolicy retryPolicy, Retryable<?> retryable, RetryException exception) Called if theRetryPolicyis interrupted between retry attempts.- Parameters:
retryPolicy- theRetryPolicyretryable- theRetryableoperationexception- the resultingRetryException, with anInterruptedExceptionas the cause and any exceptions from previous invocations of theRetryableoperation as suppressed exceptions- See Also:
-