Package org.apache.accumulo.fate.util
Class Retry
- java.lang.Object
-
- org.apache.accumulo.fate.util.Retry
-
public class Retry extends Object
Encapsulates the retrying implementation for some operation. Provides bounded retry attempts with a bounded, linear backoff.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Retry.BuilderDone
static interface
Retry.NeedsBackOffFactor
static interface
Retry.NeedsLogInterval
static interface
Retry.NeedsMaxWait
static interface
Retry.NeedsRetries
static interface
Retry.NeedsRetryDelay
static interface
Retry.NeedsTimeIncrement
static interface
Retry.RetryFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Retry.NeedsRetries
builder()
boolean
canRetry()
long
getLogInterval()
double
getWaitFactor()
boolean
hasInfiniteRetries()
boolean
hasRetried()
void
logRetry(org.slf4j.Logger log, String message)
void
logRetry(org.slf4j.Logger log, String message, Throwable t)
long
retriesCompleted()
void
setBackOffFactor(double baskOffFactor)
protected void
sleep(long wait)
void
useRetry()
void
waitForNextAttempt()
-
-
-
Method Detail
-
setBackOffFactor
public void setBackOffFactor(double baskOffFactor)
-
getWaitFactor
public double getWaitFactor()
-
hasInfiniteRetries
public boolean hasInfiniteRetries()
-
getLogInterval
public long getLogInterval()
-
canRetry
public boolean canRetry()
-
useRetry
public void useRetry()
-
hasRetried
public boolean hasRetried()
-
retriesCompleted
public long retriesCompleted()
-
waitForNextAttempt
public void waitForNextAttempt() throws InterruptedException
- Throws:
InterruptedException
-
sleep
protected void sleep(long wait) throws InterruptedException
- Throws:
InterruptedException
-
logRetry
public void logRetry(org.slf4j.Logger log, String message)
-
builder
public static Retry.NeedsRetries builder()
-
-