@InterfaceAudience.Private public class RetryCounter extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RetryCounter.BackoffPolicy
Policy for calculating sleeping intervals between retry attempts
|
static class |
RetryCounter.ExponentialBackoffPolicy |
static class |
RetryCounter.ExponentialBackoffPolicyWithLimit |
static class |
RetryCounter.RetryConfig
Configuration for a retry counter
|
Constructor and Description |
---|
RetryCounter(int maxAttempts,
long sleepInterval,
TimeUnit timeUnit) |
RetryCounter(RetryCounter.RetryConfig retryConfig) |
Modifier and Type | Method and Description |
---|---|
int |
getAttemptTimes() |
int |
getMaxAttempts() |
boolean |
isRetry() |
boolean |
shouldRetry() |
void |
sleepUntilNextRetry()
Sleep for a back off time as supplied by the backoff policy, and increases the attempts
|
void |
useRetry() |
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit)
public RetryCounter(RetryCounter.RetryConfig retryConfig)
public int getMaxAttempts()
public void sleepUntilNextRetry() throws InterruptedException
InterruptedException
public boolean shouldRetry()
public void useRetry()
public boolean isRetry()
public int getAttemptTimes()