org.jclouds.predicates
Class RetryablePredicate<T>

java.lang.Object
  extended by org.jclouds.predicates.RetryablePredicate<T>
All Implemented Interfaces:
com.google.common.base.Predicate<T>

public class RetryablePredicate<T>
extends Object
implements com.google.common.base.Predicate<T>

Retries a condition until it is met or a timeout occurs.

Author:
Adrian Cole

Field Summary
protected  Logger logger
           
 
Constructor Summary
RetryablePredicate(com.google.common.base.Predicate<T> predicate, long maxWait)
           
RetryablePredicate(com.google.common.base.Predicate<T> predicate, long maxWait, long period, long maxPeriod, TimeUnit unit)
           
RetryablePredicate(com.google.common.base.Predicate<T> predicate, long maxWait, long period, TimeUnit unit)
           
 
Method Summary
 boolean apply(T input)
           
protected  boolean atOrAfter(Date end)
           
protected  boolean before(Date end)
           
protected  long nextMaxInterval(long attempt, Date end)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Predicate
equals
 

Field Detail

logger

protected Logger logger
Constructor Detail

RetryablePredicate

public RetryablePredicate(com.google.common.base.Predicate<T> predicate,
                          long maxWait,
                          long period,
                          long maxPeriod,
                          TimeUnit unit)

RetryablePredicate

public RetryablePredicate(com.google.common.base.Predicate<T> predicate,
                          long maxWait,
                          long period,
                          TimeUnit unit)

RetryablePredicate

public RetryablePredicate(com.google.common.base.Predicate<T> predicate,
                          long maxWait)
Method Detail

apply

public boolean apply(T input)
Specified by:
apply in interface com.google.common.base.Predicate<T>

nextMaxInterval

protected long nextMaxInterval(long attempt,
                               Date end)

before

protected boolean before(Date end)

atOrAfter

protected boolean atOrAfter(Date end)


Copyright © 2009-2011 jclouds. All Rights Reserved.