Class RetryOptions

java.lang.Object
com.azure.core.http.policy.RetryOptions

public class RetryOptions extends Object
The configuration for retries.
  • Constructor Details

  • Method Details

    • getExponentialBackoffOptions

      public ExponentialBackoffOptions getExponentialBackoffOptions()
      Gets the configuration for exponential backoff if configured.
      Returns:
      The ExponentialBackoffOptions.
    • getFixedDelayOptions

      public FixedDelayOptions getFixedDelayOptions()
      Gets the configuration for exponential backoff if configured.
      Returns:
      The FixedDelayOptions.
    • getShouldRetryCondition

      public Predicate<RequestRetryCondition> getShouldRetryCondition()
      Gets the predicate that determines if a retry should be attempted.

      If null, the default behavior is to retry HTTP responses with status codes 408, 429, and any 500 status code that isn't 501 or 505. And to retry any Exception.

      Returns:
      The predicate that determines if a retry should be attempted.
    • setShouldRetryCondition

      public RetryOptions setShouldRetryCondition(Predicate<RequestRetryCondition> shouldRetryCondition)
      Sets the predicate that determines if a retry should be attempted.

      If null, the default behavior is to retry HTTP responses with status codes 408, 429, and any 500 status code that isn't 501 or 505. And to retry any Exception.

      Parameters:
      shouldRetryCondition - The predicate that determines if a retry should be attempted for the given HttpResponse.
      Returns:
      The updated RetryOptions object.