Class HttpCodesRetryChecker

  • All Implemented Interfaces:

    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 Detail


        public static final<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 Detail

      • HttpCodesRetryChecker

        public HttpCodesRetryChecker​(Set<Integer> httpCodes)
        httpCodes - the set of HTTP codes on which to retry
    • Method Detail

      • 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
        attempts - The number of attempts made
        exception - the request exception
        'true' if the caller should retry, 'false' otherwise