public abstract class RetryPolicy extends Object implements RetryPolicyFactory
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CLIENT_BACKOFF
Represents the default client backoff interval, in milliseconds.
|
static int |
DEFAULT_CLIENT_RETRY_COUNT
Represents the default client retry count.
|
static int |
DEFAULT_MAX_BACKOFF
Represents the default maximum backoff interval, in milliseconds.
|
static int |
DEFAULT_MIN_BACKOFF
Represents the default minimum backoff interval, in milliseconds.
|
protected int |
deltaBackoffIntervalInMs
Represents the realized backoff interval, in milliseconds.
|
protected Date |
lastPrimaryAttempt
Represents the time of the last request attempt to the primary location.
|
protected Date |
lastSecondaryAttempt
Represents the time of the last request attempt to the secondary location.
|
protected int |
maximumAttempts
Represents the maximum retries that the retry policy should attempt.
|
Constructor and Description |
---|
RetryPolicy()
Creates an instance of the
RetryPolicy class. |
RetryPolicy(int deltaBackoff,
int maxAttempts)
Creates an instance of the
RetryPolicy class using the specified delta backoff and maximum retry
attempts. |
Modifier and Type | Method and Description |
---|---|
abstract RetryInfo |
evaluate(RetryContext retryContext,
OperationContext operationContext)
Determines whether the operation should be retried and specifies the interval until the next retry.
|
protected boolean |
evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext)
Determines the time of the last attempt to a storage location and returns a
boolean that specifies
if a request that was sent to the secondary location failed with 404. |
protected RetryInfo |
evaluateRetryInfo(RetryContext retryContext,
boolean secondaryNotFound,
long retryInterval)
Determines the
RetryInfo object that indicates whether the next retry will happen in the primary or
secondary location, and specifies the location mode. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createInstance
public static final int DEFAULT_CLIENT_BACKOFF
public static final int DEFAULT_CLIENT_RETRY_COUNT
public static final int DEFAULT_MAX_BACKOFF
public static final int DEFAULT_MIN_BACKOFF
protected int deltaBackoffIntervalInMs
protected int maximumAttempts
protected Date lastPrimaryAttempt
protected Date lastSecondaryAttempt
public RetryPolicy()
RetryPolicy
class.public RetryPolicy(int deltaBackoff, int maxAttempts)
RetryPolicy
class using the specified delta backoff and maximum retry
attempts.deltaBackoff
- The backoff interval, in milliseconds, between retries.maxAttempts
- The maximum number of retry attempts.public abstract RetryInfo evaluate(RetryContext retryContext, OperationContext operationContext)
retryContext
- A RetryContext
object that indicates the number of retries, last request's results, whether
the next retry should happen in the primary or secondary location, and specifies the location mode.operationContext
- An OperationContext
object for tracking the current operation.RetryInfo
object that indicates whether the next retry will happen in the primary or secondary
location, and specifies the location mode. If null
, the operation will not be retried.protected boolean evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext)
boolean
that specifies
if a request that was sent to the secondary location failed with 404.retryContext
- A RetryContext
object that indicates the number of retries, last request's results, whether
the next retry should happen in the primary or secondary location, and specifies the location mode.true
if a request sent to the secondary location fails with 404 (Not Found).
false
otherwise.protected RetryInfo evaluateRetryInfo(RetryContext retryContext, boolean secondaryNotFound, long retryInterval)
RetryInfo
object that indicates whether the next retry will happen in the primary or
secondary location, and specifies the location mode.retryContext
- A RetryContext
object that indicates the number of retries, last request's results, whether
the next retry should happen in the primary or secondary location, and specifies the location mode.secondaryNotFound
- A boolean
representing whether a request sent to the secondary location failed with 404
(Not Found)retryInterval
- Backoff Interval.RetryInfo
object that indicates whether the next retry will happen in the
primary or secondary location, and specifies the location mode.Copyright © 2019. All rights reserved.