azure-docs-sdk-java/docs-ref-autogen/com.azure.core.http.policy....

91 строка
8.5 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.policy.FixedDelay"
fullName: "com.azure.core.http.policy.FixedDelay"
name: "FixedDelay"
nameWithType: "FixedDelay"
summary: "The `FixedDelay` 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 **FixedDelay**</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.FixedDelay.FixedDelay(com.azure.core.http.policy.FixedDelayOptions)"
fullName: "com.azure.core.http.policy.FixedDelay.FixedDelay(FixedDelayOptions fixedDelayOptions)"
name: "FixedDelay(FixedDelayOptions fixedDelayOptions)"
nameWithType: "FixedDelay.FixedDelay(FixedDelayOptions fixedDelayOptions)"
summary: "Creates an instance of <xref uid=\"com.azure.core.http.policy.FixedDelay\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FixedDelay\"></xref>."
parameters:
- description: "The <xref uid=\"com.azure.core.http.policy.FixedDelayOptions\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FixedDelayOptions\"></xref>."
name: "fixedDelayOptions"
type: "<xref href=\"com.azure.core.http.policy.FixedDelayOptions?alt=com.azure.core.http.policy.FixedDelayOptions&text=FixedDelayOptions\" data-throw-if-not-resolved=\"False\" />"
syntax: "public FixedDelay(FixedDelayOptions fixedDelayOptions)"
desc: "Creates an instance of <xref uid=\"com.azure.core.http.policy.FixedDelay\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FixedDelay\"></xref>."
- uid: "com.azure.core.http.policy.FixedDelay.FixedDelay(int,java.time.Duration)"
fullName: "com.azure.core.http.policy.FixedDelay.FixedDelay(int maxRetries, Duration delay)"
name: "FixedDelay(int maxRetries, Duration delay)"
nameWithType: "FixedDelay.FixedDelay(int maxRetries, Duration delay)"
summary: "Creates an instance of <xref uid=\"com.azure.core.http.policy.FixedDelay\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FixedDelay\"></xref>."
parameters:
- description: "The max number of retry attempts that can be made."
name: "maxRetries"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
- description: "The fixed delay duration between retry attempts."
name: "delay"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html\">Duration</a>"
syntax: "public FixedDelay(int maxRetries, Duration delay)"
desc: "Creates an instance of <xref uid=\"com.azure.core.http.policy.FixedDelay\" data-throw-if-not-resolved=\"false\" data-raw-source=\"FixedDelay\"></xref>."
methods:
- uid: "com.azure.core.http.policy.FixedDelay.calculateRetryDelay(int)"
fullName: "com.azure.core.http.policy.FixedDelay.calculateRetryDelay(int retryAttempts)"
name: "calculateRetryDelay(int retryAttempts)"
nameWithType: "FixedDelay.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.FixedDelay.getMaxRetries()"
fullName: "com.azure.core.http.policy.FixedDelay.getMaxRetries()"
name: "getMaxRetries()"
nameWithType: "FixedDelay.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.FixedDelay.shouldRetryCondition(com.azure.core.http.policy.RequestRetryCondition)"
fullName: "com.azure.core.http.policy.FixedDelay.shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
name: "shouldRetryCondition(RequestRetryCondition requestRetryCondition)"
nameWithType: "FixedDelay.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.FixedDelay.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.FixedDelay.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 `FixedDelay` 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 fixed delay duration between each retry attempt.\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 a fixed delay to provide a consistent delay between retries.\n\n**Code sample:**\n\nIn this example, a `FixedDelay` is created with a maximum of 3 retry attempts and a delay of 1 second between each attempt. The strategy is then used in a `RetryPolicy` which can then be added to the pipeline. For a request then sent by the pipeline, if the server responds with a transient error, the request will be retried with a fixed delay of 1 second between each attempt.\n\n```java\nFixedDelay retryStrategy = new FixedDelay(3, Duration.ofSeconds(1));\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