Interface RetryScheduler
- All Known Implementing Classes:
AbstractRetryScheduler,ExponentialBackOffIntervalRetryScheduler,IntervalRetryScheduler
public interface RetryScheduler
Interface towards a mechanism that decides whether to schedule a command for execution when a previous attempts
resulted in an exception.
- Since:
- 2.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionbooleanscheduleRetry(CommandMessage commandMessage, RuntimeException lastFailure, List<Class<? extends Throwable>[]> failures, Runnable commandDispatch) Inspect the givencommandMessagethat failed with givenlastFailure.
-
Method Details
-
scheduleRetry
boolean scheduleRetry(@Nonnull CommandMessage commandMessage, @Nonnull RuntimeException lastFailure, @Nonnull List<Class<? extends Throwable>[]> failures, @Nonnull Runnable commandDispatch) Inspect the givencommandMessagethat failed with givenlastFailure. The givenfailuresprovides a list of previous failures known for this command. ThecommandDispatchtask can be used to schedule the command for dispatching. The return value of this method indicates whether the command has been scheduled for a retry. Whentrue, the original callbacks should not be invoked, as command execution is subject to a retry. Whenfalse, the failure is interpreted as terminal and the callback will be invoked with the last failure recorded. If the implementation throws an Exception, that exception is passed as the failure to the original callback.- Parameters:
commandMessage- The Command Message being dispatchedlastFailure- The last failure recorded for this commandfailures- A condensed view of all known failures of this command. Each element in the array represents the cause of the element preceding it.commandDispatch- The task to be executed to retry a command- Returns:
trueif the command has been rescheduled, otherwisefalse
-