101 строка
11 KiB
YAML
101 строка
11 KiB
YAML
### YamlMime:JavaType
|
|
uid: "com.azure.core.http.policy.ExponentialBackoff"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff"
|
|
name: "ExponentialBackoff"
|
|
nameWithType: "ExponentialBackoff"
|
|
summary: "The `ExponentialBackoff` class is an implementation of the <xref uid=\"com.azure.core.http.policy.RetryStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RetryStrategy\"></xref> interface."
|
|
inheritances:
|
|
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
|
|
inheritedClassMethods:
|
|
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
methodsRef:
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
|
|
syntax: "public class **ExponentialBackoff**</br> implements <xref href=\"com.azure.core.http.policy.RetryStrategy?alt=com.azure.core.http.policy.RetryStrategy&text=RetryStrategy\" data-throw-if-not-resolved=\"False\" />"
|
|
constructors:
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff()"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff()"
|
|
name: "ExponentialBackoff()"
|
|
nameWithType: "ExponentialBackoff.ExponentialBackoff()"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref> with a maximum number of retry attempts configured by the environment property <xref uid=\"com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RETRY_COUNT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Configuration#PROPERTY_AZURE_REQUEST_RETRY_COUNT\"></xref>, or three if it isn't configured or is less than or equal to 0."
|
|
syntax: "public ExponentialBackoff()"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref> with a maximum number of retry attempts configured by the environment property <xref uid=\"com.azure.core.util.Configuration.PROPERTY_AZURE_REQUEST_RETRY_COUNT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Configuration#PROPERTY_AZURE_REQUEST_RETRY_COUNT\"></xref>, or three if it isn't configured or is less than or equal to 0. This strategy starts with a delay of 800 milliseconds and exponentially increases with each additional retry attempt to a maximum of 8 seconds."
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff(com.azure.core.http.policy.ExponentialBackoffOptions)"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff(ExponentialBackoffOptions options)"
|
|
name: "ExponentialBackoff(ExponentialBackoffOptions options)"
|
|
nameWithType: "ExponentialBackoff.ExponentialBackoff(ExponentialBackoffOptions options)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.core.http.policy.ExponentialBackoffOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoffOptions\"></xref>."
|
|
name: "options"
|
|
type: "<xref href=\"com.azure.core.http.policy.ExponentialBackoffOptions?alt=com.azure.core.http.policy.ExponentialBackoffOptions&text=ExponentialBackoffOptions\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public ExponentialBackoff(ExponentialBackoffOptions options)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref>."
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff(int,java.time.Duration,java.time.Duration)"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.ExponentialBackoff(int maxRetries, Duration baseDelay, Duration maxDelay)"
|
|
name: "ExponentialBackoff(int maxRetries, Duration baseDelay, Duration maxDelay)"
|
|
nameWithType: "ExponentialBackoff.ExponentialBackoff(int maxRetries, Duration baseDelay, Duration maxDelay)"
|
|
summary: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref>."
|
|
parameters:
|
|
- description: "The max retry attempts that can be made."
|
|
name: "maxRetries"
|
|
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
|
|
- description: "The base delay duration for retry."
|
|
name: "baseDelay"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
|
|
- description: "The max delay duration for retry."
|
|
name: "maxDelay"
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
|
|
syntax: "public ExponentialBackoff(int maxRetries, Duration baseDelay, Duration maxDelay)"
|
|
desc: "Creates an instance of <xref uid=\"com.azure.core.http.policy.ExponentialBackoff\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ExponentialBackoff\"></xref>."
|
|
methods:
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.calculateRetryDelay(int)"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.calculateRetryDelay(int retryAttempts)"
|
|
name: "calculateRetryDelay(int retryAttempts)"
|
|
nameWithType: "ExponentialBackoff.calculateRetryDelay(int retryAttempts)"
|
|
summary: "Computes the delay between each retry."
|
|
parameters:
|
|
- name: "retryAttempts"
|
|
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public Duration calculateRetryDelay(int retryAttempts)"
|
|
desc: "Computes the delay between each retry."
|
|
returns:
|
|
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.getMaxRetries()"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.getMaxRetries()"
|
|
name: "getMaxRetries()"
|
|
nameWithType: "ExponentialBackoff.getMaxRetries()"
|
|
summary: "Max number of retry attempts to be make."
|
|
syntax: "public int getMaxRetries()"
|
|
desc: "Max number of retry attempts to be make."
|
|
returns:
|
|
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.core.http.policy.ExponentialBackoff.shouldRetryCondition(com.azure.core.http.policy.RequestRetryCondition)"
|
|
fullName: "com.azure.core.http.policy.ExponentialBackoff.shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
|
|
name: "shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
|
|
nameWithType: "ExponentialBackoff.shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
|
|
summary: "This method is consulted to determine if a retry attempt should be made for the given <xref uid=\"com.azure.core.http.policy.RequestRetryCondition\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RequestRetryCondition\"></xref>."
|
|
parameters:
|
|
- name: "requestRetryCondition"
|
|
type: "<xref href=\"com.azure.core.http.policy.RequestRetryCondition?alt=com.azure.core.http.policy.RequestRetryCondition&text=RequestRetryCondition\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public boolean shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
|
|
desc: "This method is consulted to determine if a retry attempt should be made for the given <xref uid=\"com.azure.core.http.policy.RequestRetryCondition\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RequestRetryCondition\"></xref>.\n\nBy default, if the <xref uid=\"com.azure.core.http.policy.RequestRetryCondition\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RequestRetryCondition\"></xref> contains a non-null <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpResponse\"></xref>, then the <xref uid=\"com.azure.core.http.policy.ExponentialBackoff.shouldRetry*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#shouldRetry(HttpResponse)\"></xref> method is called, otherwise the <xref uid=\"com.azure.core.http.policy.ExponentialBackoff.shouldRetryException*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#shouldRetryException(Throwable)\"></xref> method is called."
|
|
returns:
|
|
type: "<xref href=\"boolean?alt=boolean&text=boolean\" data-throw-if-not-resolved=\"False\" />"
|
|
type: "class"
|
|
desc: "The `ExponentialBackoff` class is an implementation of the <xref uid=\"com.azure.core.http.policy.RetryStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RetryStrategy\"></xref> interface. This strategy uses a delay duration that exponentially increases with each retry attempt until an upper bound is reached, after which every retry attempt is delayed by the provided max delay duration.\n\nThis class is useful when you need to handle retries for operations that may transiently fail. It ensures that the retries are performed with an increasing delay to avoid overloading the system.\n\n**Code sample:**\n\nIn this example, an `ExponentialBackoff` is created and used in a `RetryPolicy` which can be added to a pipeline. For a request sent by the pipeline, if the server responds with a transient error, the request will be retried with an exponentially increasing delay.\n\n```java\nExponentialBackoff retryStrategy = new ExponentialBackoff();\n RetryPolicy policy = new RetryPolicy(retryStrategy);\n```"
|
|
implements:
|
|
- "<xref href=\"com.azure.core.http.policy.RetryStrategy?alt=com.azure.core.http.policy.RetryStrategy&text=RetryStrategy\" data-throw-if-not-resolved=\"False\" />"
|
|
metadata: {}
|
|
package: "com.azure.core.http.policy"
|
|
artifact: com.azure:azure-core:1.54.0
|