org.apache.accumulo.fate.zookeeper
Class Retry
java.lang.Object
org.apache.accumulo.fate.zookeeper.Retry
public class Retry
- extends Object
Encapsulates the retrying implementation for some operation. Provides bounded retry attempts with a bounded, linear backoff.
|
Constructor Summary |
Retry(long maxRetries,
long startWait,
long waitIncrement,
long maxWait)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Retry
public Retry(long maxRetries,
long startWait,
long waitIncrement,
long maxWait)
- Parameters:
maxRetries - Maximum times to retrystartWait - The amount of time (ms) to wait for the initial retrymaxWait - The maximum wait (ms)waitIncrement - The amount of time (ms) to increment next wait time by
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
Copyright © 2015 Apache Accumulo Project. All rights reserved.