Interface RetryCondition

All Known Implementing Classes:
AndRetryCondition, MaxNumberOfRetriesCondition, OrRetryCondition, RetryOnClockSkewCondition, RetryOnErrorCodeCondition, RetryOnExceptionsCondition, RetryOnStatusCodeCondition, RetryOnThrottlingCondition, TokenBucketRetryCondition
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RetryCondition
  • Method Details

    • shouldRetry

      boolean shouldRetry(RetryPolicyContext context)
      Determine whether a request should or should not be retried.
      Parameters:
      context - Context about the state of the last request and information about the number of requests made.
      Returns:
      True if the request should be retried, false if not.
    • requestWillNotBeRetried

      default void requestWillNotBeRetried(RetryPolicyContext context)
      Called by the SDK to notify this condition that the provided request will not be retried, because some retry condition determined that it shouldn't be retried.
    • requestSucceeded

      default void requestSucceeded(RetryPolicyContext context)
      Called by the SDK to notify this condition that the provided request succeeded. This method is invoked even if the execution never failed before (RetryPolicyContext.retriesAttempted() is zero).
    • defaultRetryCondition

      static RetryCondition defaultRetryCondition()
    • none

      static RetryCondition none()
      A retry condition that will NEVER allow retries.