org.jclouds.predicates
Class Retryables

java.lang.Object
  extended by org.jclouds.predicates.Retryables

@Beta
public class Retryables
extends Object

convenience methods to retry application of a predicate, and optionally (reducing quite a bit of boilerplate) get the final result or throw assertion error

Author:
alex heneveld

Constructor Summary
Retryables()
           
 
Method Summary
static
<Input> void
assertEventually(com.google.common.base.Predicate<Input> predicate, Input input, long maxWaitMillis, String failureMessage)
           
static
<Input> boolean
retry(com.google.common.base.Predicate<Input> predicate, Input input, long maxWaitMillis)
           
static
<Input> boolean
retry(com.google.common.base.Predicate<Input> predicate, Input input, long maxWait, long period, TimeUnit unit)
           
static
<Input,Result>
Result
retryGettingResultOrFailing(PredicateWithResult<Input,Result> predicate, Input input, long maxWait, long period, TimeUnit unit, String failureMessage)
           
static
<Input,Result>
Result
retryGettingResultOrFailing(PredicateWithResult<Input,Result> predicate, Input input, long maxWaitMillis, String failureMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Retryables

public Retryables()
Method Detail

retry

public static <Input> boolean retry(com.google.common.base.Predicate<Input> predicate,
                                    Input input,
                                    long maxWaitMillis)

retry

public static <Input> boolean retry(com.google.common.base.Predicate<Input> predicate,
                                    Input input,
                                    long maxWait,
                                    long period,
                                    TimeUnit unit)

assertEventually

public static <Input> void assertEventually(com.google.common.base.Predicate<Input> predicate,
                                            Input input,
                                            long maxWaitMillis,
                                            String failureMessage)

retryGettingResultOrFailing

public static <Input,Result> Result retryGettingResultOrFailing(PredicateWithResult<Input,Result> predicate,
                                                                Input input,
                                                                long maxWaitMillis,
                                                                String failureMessage)

retryGettingResultOrFailing

public static <Input,Result> Result retryGettingResultOrFailing(PredicateWithResult<Input,Result> predicate,
                                                                Input input,
                                                                long maxWait,
                                                                long period,
                                                                TimeUnit unit,
                                                                String failureMessage)


Copyright © 2009-2012 jclouds. All Rights Reserved.