Top Description Inners Fields Constructors Methods
com.oracle.bmc.waiter

public Class BmcGenericWaiter

extends Object
Class Inheritance
Imports
java.util.Optional, java.util.concurrent.Callable, java.util.function.Function, .Predicate, .Supplier, com.oracle.bmc.model.BmcException

BmcGenericWaiter is a Waiter that provides a generic foundation to build more custom waiters for specific types of calls.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
BmcGenericWaiter.WaitConditionFailedException

Exception indicating the the condition being waited on was not met before the termination condition was satisfied.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final GenericWaiter

Constructor Summary

AccessConstructor and Description
public
BmcGenericWaiter(TerminationStrategy
The termination strategy to use.
terminationStrategy
,
DelayStrategy
The delay strategy to use.
delayStrategy
)

Creates a new waiter with the given strategies.

Method Summary

Modifier and TypeMethod and Description
public <
Request object class
REQUEST
,
Response object class
RESPONSE
>
RESPONSE

Returns:

The last response object that was received and was accepted by the termination predicate (or null if 404 was allowed).
execute
(Supplier<REQUEST>
Supplier that provides a new request instance to fetch the current state.
requestSupplier
,
Function<REQUEST, RESPONSE>
Function that will be invoked to fetch the current state. It will be provided the request instance given by the requestSupplier.
functionCall
,
Predicate<RESPONSE>
The termination predicate that will inspect the current state (returned response instance) to determine if it is done waiting.
terminationPredicate
,
boolean
True to allow 404 responses to be accepted (ex, for termination conditions).
allow404
)

Blocks until a specific condition is met.

public <
Request object class
REQUEST
,
Response object class
RESPONSE
>
Callable<RESPONSE>

Returns:

The last response object that was received and was accepted by the termination predicate (or null if 404 was allowed).
toCallable
(final Supplier<REQUEST>
Supplier that provides a new request instance to fetch the current state.
requestSupplier
,
final Function<REQUEST, RESPONSE>
Function that will be invoked to fetch the current state. It will be provided the request instance given by the requestSupplier.
functionCall
,
final Predicate<RESPONSE>
The termination predicate that will inspect the current state (returned response instance) to determine if it is done waiting.
terminationPredicate
,
final boolean
True to allow 404 responses to be accepted (ex, for termination conditions).
allow404
)

Same as execute(Supplier, Function, Predicate, boolean) except it returns a Callable that can be invoked later.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
waiterback to summary
private final GenericWaiter waiter

Constructor Detail

BmcGenericWaiterback to summary
public BmcGenericWaiter(TerminationStrategy terminationStrategy, DelayStrategy delayStrategy)

Creates a new waiter with the given strategies.

Parameters
terminationStrategy:TerminationStrategy

The termination strategy to use.

delayStrategy:DelayStrategy

The delay strategy to use.

Method Detail

executeback to summary
public <REQUEST, RESPONSE> RESPONSE execute(Supplier<REQUEST> requestSupplier, Function<REQUEST, RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate, boolean allow404) throws 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.

Parameters
<REQUEST>
Request object class
<RESPONSE>
Response object class
requestSupplier:Supplier<REQUEST>

Supplier that provides a new request instance to fetch the current state.

functionCall:Function<REQUEST, RESPONSE>

Function that will be invoked to fetch the current state. It will be provided the request instance given by the requestSupplier.

terminationPredicate:Predicate<RESPONSE>

The termination predicate that will inspect the current state (returned response instance) to determine if it is done waiting.

allow404:boolean

True to allow 404 responses to be accepted (ex, for termination conditions).

Returns:RESPONSE

The last response object that was received and was accepted by the termination predicate (or null if 404 was allowed).

Exceptions
WaitConditionFailedException:
If the termination condition was not met.
toCallableback to summary
public <REQUEST, RESPONSE> Callable<RESPONSE> toCallable(final Supplier<REQUEST> requestSupplier, final Function<REQUEST, RESPONSE> functionCall, final Predicate<RESPONSE> terminationPredicate, final boolean allow404)

Same as execute(Supplier, Function, Predicate, boolean) except it returns a Callable that can be invoked later.

Parameters
<REQUEST>
Request object class
<RESPONSE>
Response object class
requestSupplier:Supplier<REQUEST>

Supplier that provides a new request instance to fetch the current state.

functionCall:Function<REQUEST, RESPONSE>

Function that will be invoked to fetch the current state. It will be provided the request instance given by the requestSupplier.

terminationPredicate:Predicate<RESPONSE>

The termination predicate that will inspect the current state (returned response instance) to determine if it is done waiting.

allow404:boolean

True to allow 404 responses to be accepted (ex, for termination conditions).

Returns:Callable<RESPONSE>

  • The last response object that was received and was accepted by the termination predicate (or null if 404 was allowed).
  • A new Callable instance.
com.oracle.bmc.waiter back to summary

public final Class BmcGenericWaiter.WaitConditionFailedException

extends Exception
Class Inheritance

Exception indicating the the condition being waited on was not met before the termination condition was satisfied.

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

WaitConditionFailedExceptionback to summary
private WaitConditionFailedException(String message)