RetryPolicy Class
- java.
lang. Object - RetryPolicyFactory
- com.
microsoft. azure. storage. RetryPolicy
- com.
public class RetryPolicy implements RetryPolicyFactory
Abstract class that represents a retry policy.
Field Summary
Modifier and Type | Field and Description |
---|---|
final int |
DEFAULT_CLIENT_BACKOFF
Represents the default client backoff interval, in milliseconds. |
final int |
DEFAULT_CLIENT_RETRY_COUNT
Represents the default client retry count. |
final int |
DEFAULT_MAX_BACKOFF
Represents the default maximum backoff interval, in milliseconds. |
final int |
DEFAULT_MIN_BACKOFF
Represents the default minimum backoff interval, in milliseconds. |
int |
deltaBackoffIntervalInMs
Represents the realized backoff interval, in milliseconds. |
Date |
lastPrimaryAttempt
Represents the time of the last request attempt to the primary location. |
Date |
lastSecondaryAttempt
Represents the time of the last request attempt to the secondary location. |
int |
maximumAttempts
Represents the maximum retries that the retry policy should attempt. |
Constructor Summary
Constructor | Description |
---|---|
RetryPolicy() |
Creates an instance of the class. |
RetryPolicy(final int deltaBackoff, final int maxAttempts) |
Creates an instance of the class using the specified delta backoff and maximum retry attempts. |
Method Summary
Modifier and Type | Method and Description |
---|---|
abstract Retry |
evaluate(RetryContext retryContext, OperationContext operationContext)
Determines whether the operation should be retried and specifies the interval until the next retry. |
boolean |
evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext)
Determines the time of the last attempt to a storage location and returns a that specifies if a request that was sent to the secondary location failed with 404. |
Retry |
evaluateRetryInfo(final RetryContext retryContext, final boolean secondaryNotFound, final 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. |
Inherited Members
Field Details
DEFAULT_CLIENT_BACKOFF
public static final int DEFAULT_CLIENT_BACKOFF= 1000 * 30
Represents the default client backoff interval, in milliseconds.
DEFAULT_CLIENT_RETRY_COUNT
public static final int DEFAULT_CLIENT_RETRY_COUNT= 3
Represents the default client retry count.
DEFAULT_MAX_BACKOFF
public static final int DEFAULT_MAX_BACKOFF= 1000 * 90
Represents the default maximum backoff interval, in milliseconds.
DEFAULT_MIN_BACKOFF
public static final int DEFAULT_MIN_BACKOFF= 1000 * 3
Represents the default minimum backoff interval, in milliseconds.
deltaBackoffIntervalInMs
protected int deltaBackoffIntervalInMs
Represents the realized backoff interval, in milliseconds.
lastPrimaryAttempt
protected Date lastPrimaryAttempt= null
Represents the time of the last request attempt to the primary location.
lastSecondaryAttempt
protected Date lastSecondaryAttempt= null
Represents the time of the last request attempt to the secondary location.
maximumAttempts
protected int maximumAttempts
Represents the maximum retries that the retry policy should attempt.
Constructor Details
RetryPolicy
public RetryPolicy()
Creates an instance of the class.
RetryPolicy
public RetryPolicy(final int deltaBackoff, final int maxAttempts)
Creates an instance of the class using the specified delta backoff and maximum retry attempts.
Parameters:
Method Details
evaluate
public abstract RetryInfo evaluate(RetryContext retryContext, OperationContext operationContext)
Determines whether the operation should be retried and specifies the interval until the next retry.
Parameters:
Returns:
null
, the operation will not be retried.evaluateLastAttemptAndSecondaryNotFound
protected boolean evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext)
Determines the time of the last attempt to a storage location and returns a that specifies if a request that was sent to the secondary location failed with 404.
Parameters:
Returns:
true
if a request sent to the secondary location fails with 404 (Not Found). false
otherwise.
evaluateRetryInfo
protected RetryInfo evaluateRetryInfo(final RetryContext retryContext, final boolean secondaryNotFound, final 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.
Parameters:
boolean
representing whether a request sent to the secondary location failed with 404 (Not Found)
Returns:
Applies to
Azure SDK for Java