org.jclouds.predicates
Class RetryablePredicate<T>
java.lang.Object
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.
maxWait parameter is required.
Initial retry period and retry maxPeriod are optionally configurable,
defaulting to 50ms and 1000ms respectively,
with the retrier increasing the interval by a factor of 1.5 each time within these constraints.
All values taken as millis unless TimeUnit specified.
- Author:
- Adrian Cole
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 |
logger
protected Logger logger
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)
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-2012 jclouds. All Rights Reserved.