E
- The type parameter of the Exception
instance signifying
terminal failure of the RetryPolicy
execution.public abstract class LinearDelayRetryPolicy<E extends Exception> extends RetryPolicy<E>
RetryPolicy
that defines a maximum number of retries, and a
constant delay for retry attempts.Constructor and Description |
---|
LinearDelayRetryPolicy(int maxRetries,
int delayMs,
boolean noDelayOnFirstRetry,
double jitter)
Creates a new
LinearDelayRetryPolicy with the specified maximum
number of retries, and a constant delay for retry attempts. |
Modifier and Type | Method and Description |
---|---|
protected long |
getDelayMs(int attemptNo)
Returns the delay in milliseconds for the specified attempt number.
|
getMaxRetries, onRetry, onRetryFailure, retryOn, run, run
public LinearDelayRetryPolicy(int maxRetries, int delayMs, boolean noDelayOnFirstRetry, double jitter)
LinearDelayRetryPolicy
with the specified maximum
number of retries, and a constant delay for retry attempts.maxRetries
- A positive value representing the number of retry
attempts allowed by the LinearDelayRetryPolicy
.delayMs
- A positive value representing the constant delay between
retry attempts, in milliseconds.noDelayOnFirstRetry
- true
for the first retry to be attempted
immediately, otherwise false
for the first retry to be
attempted after delayMs
.jitter
- The factor multiplier to be applied to delayMs
to
thereafter be added to the delay for each retry.IllegalArgumentException
- If delayMs
, maxRetries
or
jitter
is negative.protected long getDelayMs(int attemptNo)
RetryPolicy
getDelayMs
in class RetryPolicy<E extends Exception>
attemptNo
- The attempt number, starting with 1
.Copyright © 2020 LibJ. All rights reserved.