public final class Waiter<T> extends Object
Modifier and Type | Method and Description |
---|---|
Waiter<T> |
failOn(Predicate<T> whenToFail)
Define the condition on the response under which the thing we are trying has already failed and further
attempts are pointless.
|
Waiter<T> |
ignoringException(Class<? extends Throwable>... whatToIgnore)
Define the exception types that should be ignored if the thing we are trying throws them.
|
T |
orFail()
Execute the function, throwing an assertion error if the thing we're trying does not succeed after 30 seconds.
|
T |
orFailAfter(Duration howLongToTry)
Execute the function, throwing an assertion error if the thing we're trying does not succeed after the provided duration.
|
static <T> Waiter<T> |
run(Supplier<T> thingToTry)
Create a waiter that attempts executing the provided function until the condition set with
until(Predicate) is
met or until it throws an exception. |
Waiter<T> |
until(Predicate<T> whenToStop)
Define the condition on the response under which the thing we are trying is complete.
|
Waiter<T> |
untilException(Class<? extends Throwable>... whenToStopOnException)
Define the condition on an exception thrown under which the thing we are trying is complete.
|
public static <T> Waiter<T> run(Supplier<T> thingToTry)
until(Predicate)
is
met or until it throws an exception. Expected exception types can be ignored with ignoringException(Class[])
.public Waiter<T> until(Predicate<T> whenToStop)
public Waiter<T> failOn(Predicate<T> whenToFail)
@SafeVarargs public final Waiter<T> untilException(Class<? extends Throwable>... whenToStopOnException)
@SafeVarargs public final Waiter<T> ignoringException(Class<? extends Throwable>... whatToIgnore)
public T orFail()
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.