public class ExponentialBackoff extends Object implements RetryStrategy
RetryStrategy that has a delay duration that exponentially
increases with each retry attempt until an upper bound is reached after which every retry attempt is delayed by the
provided max delay duration.HTTP_STATUS_TOO_MANY_REQUESTS| Constructor and Description |
|---|
ExponentialBackoff()
Creates an instance of
ExponentialBackoff with a maximum of three retry attempts. |
ExponentialBackoff(int maxRetries,
Duration baseDelay,
Duration maxDelay)
Creates an instance of
ExponentialBackoff. |
| Modifier and Type | Method and Description |
|---|---|
Duration |
calculateRetryDelay(int retryAttempts)
Computes the delay between each retry.
|
int |
getMaxRetries()
Max number of retry attempts to be make.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitshouldRetrypublic ExponentialBackoff()
ExponentialBackoff with a maximum of three retry attempts. This strategy starts
with a delay of 800 milliseconds and exponentially increases with each additional retry attempt.public ExponentialBackoff(int maxRetries,
Duration baseDelay,
Duration maxDelay)
ExponentialBackoff.maxRetries - The max retry attempts that can be made.baseDelay - The base delay duration for retry.maxDelay - The max delay duration for retry.public int getMaxRetries()
RetryStrategygetMaxRetries in interface RetryStrategypublic Duration calculateRetryDelay(int retryAttempts)
RetryStrategycalculateRetryDelay in interface RetryStrategyretryAttempts - The number of retry attempts completed so far.Copyright © 2020 Microsoft Corporation. All rights reserved.