@InterfaceAudience.Private public class RetryCounter extends Object
getBackoffTimeAndIncrementAttempts()
}, or for performing wait,
sleepUntilNextRetry()
, in accordance with a RetryCounter.RetryConfig
, initial settings, and a
Retry Policy, (See org.apache.hadoop.io.retry.RetryPolicy). Like guava-retrying.RetryCounterFactory
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
|
Modifier and Type | Field and Description |
---|---|
private int |
attempts |
private static org.slf4j.Logger |
LOG |
private RetryCounter.RetryConfig |
retryConfig |
Constructor and Description |
---|
RetryCounter(int maxAttempts,
long sleepInterval,
TimeUnit timeUnit) |
RetryCounter(RetryCounter.RetryConfig retryConfig) |
Modifier and Type | Method and Description |
---|---|
private static long |
addJitter(long interval,
float jitter) |
int |
getAttemptTimes() |
long |
getBackoffTime() |
long |
getBackoffTimeAndIncrementAttempts() |
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() |
private static final org.slf4j.Logger LOG
private RetryCounter.RetryConfig retryConfig
private int attempts
public RetryCounter(int maxAttempts, long sleepInterval, TimeUnit timeUnit)
public RetryCounter(RetryCounter.RetryConfig retryConfig)
private static long addJitter(long interval, float jitter)
public int getMaxAttempts()
public void sleepUntilNextRetry() throws InterruptedException
InterruptedException
public boolean shouldRetry()
public void useRetry()
public boolean isRetry()
public int getAttemptTimes()
public long getBackoffTime()
public long getBackoffTimeAndIncrementAttempts()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.