다음을 통해 공유


FixedDelayOptions Class

  • java.lang.Object
    • com.azure.core.http.policy.FixedDelayOptions

public class 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);

Constructor Summary

Constructor Description
FixedDelayOptions(int maxRetries, Duration delay)

Creates an instance of FixedDelayOptions.

Method Summary

Modifier and Type Method and Description
Duration getDelay()

Gets the max retry attempts that can be made.

int getMaxRetries()

Gets the max retry attempts that can be made.

Methods inherited from java.lang.Object

Constructor Details

FixedDelayOptions

public FixedDelayOptions(int maxRetries, Duration delay)

Creates an instance of FixedDelayOptions.

Parameters:

maxRetries - The max number of retry attempts that can be made.
delay - The fixed delay duration between retry attempts.

Method Details

getDelay

public Duration getDelay()

Gets the max retry attempts that can be made.

Returns:

The max retry attempts that can be made.

getMaxRetries

public int getMaxRetries()

Gets the max retry attempts that can be made.

Returns:

The max retry attempts that can be made.

Applies to