Package com.cloudera.cdp.http
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 Summary
Fields Modifier and Type Field Description static 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 Summary
Constructors Constructor Description HttpCodesRetryChecker(Set<Integer> httpCodes)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldRetry(int attempts, CdpClientException exception)
Returns 'true' if the call should be retried, 'false' otherwise.
-
-
-
Field Detail
-
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.
-
-
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 interfaceRetryChecker
- Parameters:
attempts
- The number of attempts madeexception
- the request exception- Returns:
- 'true' if the caller should retry, 'false' otherwise
-
-