org.apache.sling.testing.tools.retry
Class RetryLoop

java.lang.Object
  extended by org.apache.sling.testing.tools.retry.RetryLoop

public class RetryLoop
extends java.lang.Object

Convenience class for retrying tests until timeout or success.


Nested Class Summary
static interface RetryLoop.Condition
          Interface for conditions to check, isTrue will be called repeatedly until success or timeout
 
Constructor Summary
RetryLoop(RetryLoop.Condition c, int timeoutSeconds, int intervalBetweenTriesMsec)
          Retry Condition c until it returns true or timeout.
 
Method Summary
protected  long getRemainingTimeSeconds()
           
protected  void onTimeout()
          Called if the loop times out without success, just before failing
protected  void reportException(java.lang.Throwable t)
          Can be overridden to report Exceptions that happen in the retry loop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetryLoop

public RetryLoop(RetryLoop.Condition c,
                 int timeoutSeconds,
                 int intervalBetweenTriesMsec)
Retry Condition c until it returns true or timeout. See RetryLoop.Condition for isTrue semantics.

Method Detail

reportException

protected void reportException(java.lang.Throwable t)
Can be overridden to report Exceptions that happen in the retry loop


onTimeout

protected void onTimeout()
Called if the loop times out without success, just before failing


getRemainingTimeSeconds

protected long getRemainingTimeSeconds()


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.