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 interfaceRetry.BuilderDonestatic interfaceRetry.NeedsBackOffFactorstatic interfaceRetry.NeedsLogIntervalstatic interfaceRetry.NeedsMaxWaitstatic interfaceRetry.NeedsRetriesstatic interfaceRetry.NeedsRetryDelaystatic interfaceRetry.NeedsTimeIncrementstatic interfaceRetry.RetryFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Retry.NeedsRetriesbuilder()booleancanRetry()longgetLogInterval()doublegetWaitFactor()booleanhasInfiniteRetries()booleanhasRetried()voidlogRetry(org.slf4j.Logger log, String message)voidlogRetry(org.slf4j.Logger log, String message, Throwable t)longretriesCompleted()voidsetBackOffFactor(double baskOffFactor)protected voidsleep(long wait)voiduseRetry()voidwaitForNextAttempt()
-
-
-
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()
-
-