org.apache.accumulo.fate.zookeeper
Class Retry

java.lang.Object
  extended by 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)
           
 
Method Summary
 boolean canRetry()
           
 boolean hasRetried()
           
 long retriesCompleted()
           
protected  void sleep(long wait)
           
 void useRetry()
           
 void waitForNextAttempt()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Retry

public Retry(long maxRetries,
             long startWait,
             long waitIncrement,
             long maxWait)
Parameters:
maxRetries - Maximum times to retry
startWait - The amount of time (ms) to wait for the initial retry
maxWait - The maximum wait (ms)
waitIncrement - The amount of time (ms) to increment next wait time by
Method Detail

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.