public class GenericWaiter extends Object
Provides a basic waiter that will periodically poll for an update until a desired condition is met.
Constructor and Description |
---|
GenericWaiter(WaiterConfiguration waiterConfiguration) |
Modifier and Type | Method and Description |
---|---|
<REQUEST,RESPONSE> |
execute(Supplier<REQUEST> requestSupplier,
Function<REQUEST,RESPONSE> functionCall,
Predicate<RESPONSE> terminationPredicate)
Blocks until a specific condition is met.
|
<T> CompletionStage<Optional<T>> |
executeAsync(WaiterScheduler runner,
Supplier<CompletionStage<T>> downstream,
Predicate<T> terminationPredicate) |
WaiterConfiguration |
getWaiterConfiguration() |
@ConstructorProperties(value="waiterConfiguration") public GenericWaiter(WaiterConfiguration waiterConfiguration)
public <REQUEST,RESPONSE> Optional<RESPONSE> execute(Supplier<REQUEST> requestSupplier, Function<REQUEST,RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate)
Blocks until a specific condition is met.
REQUEST
- Request object classRESPONSE
- Response object classrequestSupplier
- Supplier that provides a new request instance to fetch the current
state.functionCall
- Function that will be invoked to fetch the current state. It will be
provided the request instance given by the requestSupplier.terminationPredicate
- The termination predicate that will inspect the current state
(returned response instance) to determine if it is done waiting.public WaiterConfiguration getWaiterConfiguration()
public <T> CompletionStage<Optional<T>> executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> downstream, Predicate<T> terminationPredicate)
Copyright © 2016–2024. All rights reserved.