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
FieldsModifier 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanshouldRetry(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:RetryCheckerReturns 'true' if the call should be retried, 'false' otherwise.- Specified by:
shouldRetryin interfaceRetryChecker- Parameters:
attempts- The number of attempts madeexception- the request exception- Returns:
- 'true' if the caller should retry, 'false' otherwise
-