public abstract class AbstractRetryScheduler extends Object implements RetryScheduler
RetrySchedulers. This class provides methods to do the actual rescheduling and decides if a given
Throwableis explicitly transient.
|Modifier and Type||Class and Description|
A builder class for the
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Compute the amount of milliseconds delay until the next retry, given the information passed.
Indicates whether the given
This is the entrypoint of the
Schedule the provided task to run after the given interval.
protected boolean scheduleRetry(Runnable commandDispatch, long interval)
interval- the number of milliseconds delay.
trueif the task was accepted for scheduling,
protected abstract long computeRetryInterval(CommandMessage commandMessage, RuntimeException lastFailure, List<Class<? extends Throwable>> failures)
commandMessage- the command that was sent (and failed).
lastFailure- the last failure that caused this retry scheduler to be called.
Listof all failures up to now.
protected boolean isExplicitlyNonTransient(Throwable failure)
failureis clearly non-transient. That means, whether the
failureexplicitly states that a retry of the same Command would result in the same failure to occur again. In this implementation, given
failure(and its causes) is tested against configured composable
nonTransientFailurePredicate. By default,
nonTransientFailurePredicateis configured only with
failure- the exception that occurred while processing a command
trueif the exception is clearly non-transient and the command should not be retried, or
falsewhen the command has a chance of succeeding if it retried.
public boolean scheduleRetry(@Nonnull CommandMessage commandMessage, @Nonnull RuntimeException lastFailure, @Nonnull List<Class<? extends Throwable>> failures, @Nonnull Runnable dispatchTask)
RetryScheduler. This default implementation checks if the last failure was transient, and if so reschedules a command dispatch.
commandMessage- The Command Message being dispatched
lastFailure- The last failure recorded for this command
failures- A condensed view of all known failures of this command. Each element in the array represents the cause of the element preceding it.
dispatchTask- the task that performs the actual dispatching.
trueif rescheduling succeeded,
Copyright © 2010–2023. All rights reserved.