public class ExponentialBackoffRetryPolicy extends RetryPolicy
RetryPolicy that defines a maximum number of retries, and a
delay for retry attempts that increases exponentially based on a backoff factor.| Constructor and Description |
|---|
ExponentialBackoffRetryPolicy(int maxRetries,
int delayMs,
double backoffFactor,
int maxDelayMs,
boolean noDelayOnFirstRetry,
double jitter)
Creates a new
ExponentialBackoffRetryPolicy with the specified
maximum number of retries, and a delay for retry attempts that increases
exponentially based on a backoff factor. |
| Modifier and Type | Method and Description |
|---|---|
long |
getDelayMs(int attemptNo)
Returns the delay in milliseconds for the specified attempt number.
|
getMaxRetries, retryOn, run, runpublic ExponentialBackoffRetryPolicy(int maxRetries,
int delayMs,
double backoffFactor,
int maxDelayMs,
boolean noDelayOnFirstRetry,
double jitter)
ExponentialBackoffRetryPolicy with the specified
maximum number of retries, and a delay for retry attempts that increases
exponentially based on a backoff factor.maxRetries - A positive value representing the number of retry
attempts allowed by the ExponentialBackoffRetryPolicy.delayMs - A positive value representing the delay for the first retry,
in milliseconds, which is also used as the multiplicative factor
for subsequent backed-off delays.backoffFactor - The base of the backoff exponential function, i.e. a
value of 2 represents a backoff function of 2^a,
where a is the attempt number.maxDelayMs - The maximum delay, in milliseconds, which takes effect if
the delay computed by the backoff function is a greater value.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, maxDelayMs,
maxRetries or jitter is negative.public long getDelayMs(int attemptNo)
RetryPolicygetDelayMs in class RetryPolicyattemptNo - The attempt number, starting with 1.Copyright © 2020 LightStep. All rights reserved.