public class ExponentialBackoffWithJitter extends Object implements RetryPolicy
Constructor and Description |
---|
ExponentialBackoffWithJitter()
Constructor with default backoff values and firstFastRetry
|
ExponentialBackoffWithJitter(int retryCount,
long minBackoff,
long maxBackoff,
long deltaBackoff,
boolean firstFastRetry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
RetryDecision |
getRetryDecision(int currentRetryCount,
TransportException lastException)
Determines whether the operation should be retried and the interval until the next retry.
|
public ExponentialBackoffWithJitter()
public ExponentialBackoffWithJitter(int retryCount, long minBackoff, long maxBackoff, long deltaBackoff, boolean firstFastRetry)
retryCount
- the max number of retries allowed in the policies.minBackoff
- the min interval between each retry.maxBackoff
- the max interval between each retry.deltaBackoff
- the max delta allowed between retries.firstFastRetry
- indicates whether the first retry should be immediate.public RetryDecision getRetryDecision(int currentRetryCount, TransportException lastException)
getRetryDecision
in interface RetryPolicy
currentRetryCount
- the number of retries for the given operationlastException
- the latest exception explaining why the retry is happening. This exception is guaranteed to
be retryable. In the event of a terminal exception occurring, this API will not be called.
Looking at this exception allows you to prevent retry on certain retryable exceptions, but
does not allow you to retry exceptions that are terminal.Copyright © 2020. All rights reserved.