public final class ExponentialBackoffRetryStrategy extends RetryStrategy
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CLIENT_BACKOFF
Represents the default amount of time used when calculating a random delta in the exponential
delay between retries.
|
static int |
DEFAULT_MAX_BACKOFF
Represents the default maximum amount of time used when calculating the exponential
delay between retries.
|
static int |
DEFAULT_MIN_BACKOFF
Represents the default minimum amount of time used when calculating the exponential
delay between retries.
|
DEFAULT_CLIENT_RETRY_COUNT, DEFAULT_FIRST_FAST_RETRY, DEFAULT_RETRY_INTERVAL
Constructor and Description |
---|
ExponentialBackoffRetryStrategy()
Initializes a new instance of the
ExponentialBackoffRetryStrategy class. |
ExponentialBackoffRetryStrategy(int retryCount,
int minBackoff,
int maxBackoff,
int deltaBackoff)
Initializes a new instance of the
ExponentialBackoffRetryStrategy class. |
ExponentialBackoffRetryStrategy(String name,
int retryCount,
int minBackoff,
int maxBackoff,
int deltaBackoff,
boolean firstFastRetry)
Initializes a new instance of the
ExponentialBackoffRetryStrategy class. |
Modifier and Type | Method and Description |
---|---|
boolean |
shouldRetry(int retryCount,
okhttp3.Response response)
Returns if a request should be retried based on the retry count, current response,
and the current strategy.
|
isFastFirstRetry, name
public static final int DEFAULT_CLIENT_BACKOFF
public static final int DEFAULT_MAX_BACKOFF
public static final int DEFAULT_MIN_BACKOFF
public ExponentialBackoffRetryStrategy()
ExponentialBackoffRetryStrategy
class.public ExponentialBackoffRetryStrategy(int retryCount, int minBackoff, int maxBackoff, int deltaBackoff)
ExponentialBackoffRetryStrategy
class.retryCount
- The maximum number of retry attempts.minBackoff
- The minimum backoff time.maxBackoff
- The maximum backoff time.deltaBackoff
- The value that will be used to calculate a random delta in the exponential delay
between retries.public ExponentialBackoffRetryStrategy(String name, int retryCount, int minBackoff, int maxBackoff, int deltaBackoff, boolean firstFastRetry)
ExponentialBackoffRetryStrategy
class.name
- The name of the retry strategy.retryCount
- The maximum number of retry attempts.minBackoff
- The minimum backoff time.maxBackoff
- The maximum backoff time.deltaBackoff
- The value that will be used to calculate a random delta in the exponential delay
between retries.firstFastRetry
- true to immediately retry in the first attempt; otherwise, false. The subsequent
retries will remain subject to the configured retry interval.public boolean shouldRetry(int retryCount, okhttp3.Response response)
shouldRetry
in class RetryStrategy
retryCount
- The current retry attempt count.response
- The exception that caused the retry conditions to occur.Copyright © 2019. All rights reserved.