Class HttpCodesRetryChecker

java.lang.Object
com.cloudera.cdp.http.HttpCodesRetryChecker
All Implemented Interfaces:
RetryChecker

public class HttpCodesRetryChecker extends Object implements RetryChecker
RetryChecker that compares the status code of the HTTP response to the set of retriable HTTP codes.
  • Field Details

    • DEFAULT_RETRY_CODES

      public static final com.google.common.collect.ImmutableSet<Integer> DEFAULT_RETRY_CODES
      We retry on the following HTTP codes: 503: Service unavailable: we expect this from time to time from our load balancers 429: Too many requests: this is CDP API throttling.
  • Constructor Details

    • HttpCodesRetryChecker

      public HttpCodesRetryChecker(Set<Integer> httpCodes)
      Constructor.
      Parameters:
      httpCodes - the set of HTTP codes on which to retry
  • Method Details

    • shouldRetry

      public boolean shouldRetry(int attempts, CdpClientException exception)
      Description copied from interface: RetryChecker
      Returns 'true' if the call should be retried, 'false' otherwise.
      Specified by:
      shouldRetry in interface RetryChecker
      Parameters:
      attempts - The number of attempts made
      exception - the request exception
      Returns:
      'true' if the caller should retry, 'false' otherwise