Package com.cloudera.cdp.http
Class HttpCodesRetryChecker
java.lang.Object
com.cloudera.cdp.http.HttpCodesRetryChecker
- All Implemented Interfaces:
RetryChecker
RetryChecker that compares the status code of the HTTP response to the
set of retriable HTTP codes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.google.common.collect.ImmutableSet
<Integer> 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
shouldRetry
(int attempts, CdpClientException exception) Returns 'true' if the call should be retried, 'false' otherwise.
-
Field Details
-
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
Constructor.- Parameters:
httpCodes
- the set of HTTP codes on which to retry
-
-
Method Details
-
shouldRetry
Description copied from interface:RetryChecker
Returns 'true' if the call should be retried, 'false' otherwise.- Specified by:
shouldRetry
in interfaceRetryChecker
- Parameters:
attempts
- The number of attempts madeexception
- the request exception- Returns:
- 'true' if the caller should retry, 'false' otherwise
-