Package com.azure.core.http.policy
Class FixedDelayOptions
java.lang.Object
com.azure.core.http.policy.FixedDelayOptions
The
FixedDelayOptions class provides configuration options for the FixedDelay retry strategy.
This strategy uses a fixed delay duration between each retry attempt.
This class is useful when you need to customize the behavior of the fixed delay retry strategy. It allows you to specify the maximum number of retry attempts and the delay duration between each attempt.
Code sample:
In this example, a FixedDelayOptions is created and used to configure a FixedDelay retry strategy.
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
between each attempt.
FixedDelayOptions options = new FixedDelayOptions(3, Duration.ofSeconds(1)); FixedDelay retryStrategy = new FixedDelay(options);
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFixedDelayOptions(int maxRetries, Duration delay) Creates an instance ofFixedDelayOptions. -
Method Summary
Modifier and TypeMethodDescriptiongetDelay()Gets the max retry attempts that can be made.intGets the max retry attempts that can be made.
-
Constructor Details
-
FixedDelayOptions
Creates an instance ofFixedDelayOptions.- Parameters:
maxRetries- The max number of retry attempts that can be made.delay- The fixed delay duration between retry attempts.- Throws:
IllegalArgumentException- IfmaxRetriesis negative.NullPointerException- Ifdelayisnull.
-
-
Method Details
-
getMaxRetries
public int getMaxRetries()Gets the max retry attempts that can be made.- Returns:
- The max retry attempts that can be made.
-
getDelay
Gets the max retry attempts that can be made.- Returns:
- The max retry attempts that can be made.
-