public abstract class RetryPolicy extends Object
| 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 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 RetryResult |
shouldRetry(int currentRetryCount,
int statusCode,
Exception lastException,
OperationContext opContext)
Determines if the operation should be retried and how long to wait until the next retry.
|
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
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 RetryResult shouldRetry(int currentRetryCount, int statusCode, Exception lastException, OperationContext opContext)
currentRetryCount - The number of retries for the given operation. A value of zero signifies this is the first error
encountered.statusCode - The status code for the last operation.lastException - A Exception object that represents the last exception encountered.opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.RetryResult object that indicates whether the operation should be retried and how long to
backoff./**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/