Package com.cloudera.cdp.http
Class SimpleRetryHandler
java.lang.Object
com.cloudera.cdp.http.SimpleRetryHandler
- All Implemented Interfaces:
RetryHandler
Handle retry attempts with the given checker and delay policy.
-
Field Summary
Fields inherited from interface com.cloudera.cdp.http.RetryHandler
DO_NOT_RETRY
-
Constructor Summary
ConstructorDescriptionSimpleRetryHandler
(RetryChecker retryChecker, DelayPolicy delayPolicy, int maxAttempts) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionshouldRetry
(int attempts, CdpClientException exception) Returns the duration the caller need to wait before retrying or null if no retry should be attempted according to the retry policy.
-
Constructor Details
-
SimpleRetryHandler
Constructor.- Parameters:
retryChecker
- the retry checkerdelayPolicy
- the delay policymaxAttempts
- the maximum number of allowed attempts
-
-
Method Details
-
shouldRetry
Description copied from interface:RetryHandler
Returns the duration the caller need to wait before retrying or null if no retry should be attempted according to the retry policy.- Specified by:
shouldRetry
in interfaceRetryHandler
- Parameters:
attempts
- the number of attempts so farexception
- the request exception- Returns:
- the duration to wait for the next attempt or null if no retry should be attempted
-