public class BmcGenericWaiter extends Object
BmcGenericWaiter is a Waiter that provides a generic foundation to build more custom waiters for specific types of calls.
Modifier and Type | Class and Description |
---|---|
static class |
BmcGenericWaiter.WaitConditionFailedException
Exception indicating the the condition being waited on was not met before the termination
condition was satisfied.
|
Constructor and Description |
---|
BmcGenericWaiter(TerminationStrategy terminationStrategy,
DelayStrategy delayStrategy)
Creates a new waiter with the given strategies.
|
Modifier and Type | Method and Description |
---|---|
<REQUEST,RESPONSE> |
execute(Supplier<REQUEST> requestSupplier,
Function<REQUEST,RESPONSE> functionCall,
Predicate<RESPONSE> terminationPredicate,
boolean allow404)
Blocks until a specific condition is met.
|
<REQUEST,RESPONSE> |
toCallable(Supplier<REQUEST> requestSupplier,
Function<REQUEST,RESPONSE> functionCall,
Predicate<RESPONSE> terminationPredicate,
boolean allow404)
Same as
execute(Supplier, Function, Predicate, boolean) except it returns a Callable that can be invoked later. |
public BmcGenericWaiter(TerminationStrategy terminationStrategy, DelayStrategy delayStrategy)
Creates a new waiter with the given strategies.
terminationStrategy
- The termination strategy to use.delayStrategy
- The delay strategy to use.public <REQUEST,RESPONSE> RESPONSE execute(Supplier<REQUEST> requestSupplier, Function<REQUEST,RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate, boolean allow404) throws BmcGenericWaiter.WaitConditionFailedException
Blocks until a specific condition is met.
If the allow404
param is set to true, the waiter will return null if the
request fails with a 404 exception.
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.allow404
- True to allow 404 responses to be accepted (ex, for termination conditions).BmcGenericWaiter.WaitConditionFailedException
- If the termination condition was not met.public <REQUEST,RESPONSE> Callable<RESPONSE> toCallable(Supplier<REQUEST> requestSupplier, Function<REQUEST,RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate, boolean allow404)
Same as execute(Supplier, Function, Predicate, boolean)
except it returns a Callable
that can be invoked later.
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.allow404
- True to allow 404 responses to be accepted (ex, for termination conditions).Copyright © 2016–2024. All rights reserved.