Package com.oracle.bmc.waiter
Class GenericWaiter
- java.lang.Object
-
- com.oracle.bmc.waiter.GenericWaiter
-
public class GenericWaiter extends Object
Provides a basic waiter that will periodically poll for an update until a desired condition is met.
-
-
Constructor Summary
Constructors Constructor Description GenericWaiter(WaiterConfiguration waiterConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <REQUEST,RESPONSE>
Optional<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()
-
-
-
Constructor Detail
-
GenericWaiter
@ConstructorProperties("waiterConfiguration") public GenericWaiter(WaiterConfiguration waiterConfiguration)
-
-
Method Detail
-
execute
public <REQUEST,RESPONSE> Optional<RESPONSE> execute(Supplier<REQUEST> requestSupplier, Function<REQUEST,RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate)
Blocks until a specific condition is met.- Type Parameters:
REQUEST
- Request object classRESPONSE
- Response object class- Parameters:
requestSupplier
- 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.- Returns:
- The last response object that was received and was accepted by the termination predicate, or empty if the waiter reached the max timeout.
-
getWaiterConfiguration
public WaiterConfiguration getWaiterConfiguration()
-
executeAsync
public <T> CompletionStage<Optional<T>> executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> downstream, Predicate<T> terminationPredicate)
-
-