public abstract class RetryStrategy extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CLIENT_RETRY_COUNT
Represents the default number of retry attempts.
|
static boolean |
DEFAULT_FIRST_FAST_RETRY
Represents the default flag indicating whether the first retry attempt will be made immediately,
whereas subsequent retries will remain subject to the retry interval.
|
static int |
DEFAULT_RETRY_INTERVAL
Represents the default interval between retries.
|
Modifier | Constructor and Description |
---|---|
protected |
RetryStrategy(String name,
boolean firstFastRetry)
Initializes a new instance of the
RetryStrategy class. |
Modifier and Type | Method and Description |
---|---|
boolean |
isFastFirstRetry()
Gets whether the first retry attempt will be made immediately.
|
String |
name()
Gets the name of the retry strategy.
|
abstract 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.
|
public static final int DEFAULT_CLIENT_RETRY_COUNT
public static final int DEFAULT_RETRY_INTERVAL
public static final boolean DEFAULT_FIRST_FAST_RETRY
protected RetryStrategy(String name, boolean firstFastRetry)
RetryStrategy
class.name
- The name of the retry strategy.firstFastRetry
- true to immediately retry in the first attempt; otherwise, false.public abstract boolean shouldRetry(int retryCount, okhttp3.Response response)
retryCount
- The current retry attempt count.response
- The exception that caused the retry conditions to occur.public String name()
public boolean isFastFirstRetry()
Copyright © 2019. All rights reserved.