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

public Class GenericWaiter

extends Object
Class Inheritance
Imports
java.util.Optional, java.util.function.Function, .Predicate, .Supplier, com.oracle.bmc.ServiceDetails, com.oracle.bmc.waiter.WaiterConfiguration.WaitContext, java.util.concurrent.CompletableFuture, .CompletionStage, .Future, .ScheduledExecutorService, .TimeUnit

Provides a basic waiter that will periodically poll for an update until a desired condition is met.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
GenericWaiter(final WaiterConfiguration waiterConfiguration)

Method Summary

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

Returns:

The last response object that was received and was accepted by the termination predicate, or empty if the waiter reached the max timeout.
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
)

Blocks until a specific condition is met.

public <T> CompletionStage<Optional<T>>
executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> downstream, Predicate<T> terminationPredicate)

private <T> CompletionStage<Optional<T>>
executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> upstream, Predicate<T> terminationPredicate, WaiterConfiguration.WaitContext context)

private static <T> CompletionStage<T>
public WaiterConfiguration
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
waiterConfigurationback to summary
private final WaiterConfiguration waiterConfiguration

Constructor Detail

GenericWaiterback to summary
public GenericWaiter(final WaiterConfiguration waiterConfiguration)
Annotations
@java.beans.ConstructorProperties

Method Detail

executeback to summary
public <REQUEST, RESPONSE> Optional<RESPONSE> execute(Supplier<REQUEST> requestSupplier, Function<REQUEST, RESPONSE> functionCall, Predicate<RESPONSE> terminationPredicate)

Blocks until a specific condition is met.

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.

Returns:Optional<RESPONSE>

The last response object that was received and was accepted by the termination predicate, or empty if the waiter reached the max timeout.

executeAsyncback to summary
public <T> CompletionStage<Optional<T>> executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> downstream, Predicate<T> terminationPredicate)
executeAsyncback to summary
private <T> CompletionStage<Optional<T>> executeAsync(WaiterScheduler runner, Supplier<CompletionStage<T>> upstream, Predicate<T> terminationPredicate, WaiterConfiguration.WaitContext context)
failedFutureback to summary
private static <T> CompletionStage<T> failedFuture(Throwable t)
getWaiterConfigurationback to summary
public WaiterConfiguration getWaiterConfiguration()
com.oracle.bmc.waiter back to summary

private Class GenericWaiter.CancellableCompletableFuture<T>

extends CompletableFuture<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv volatile Future<?>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(boolean
this value has no effect in this implementation because interrupts are not used to control processing.
mayInterruptIfRunning
)

Overrides java.util.concurrent.CompletableFuture.cancel.

Implements java.util.concurrent.Future.cancel.

If not already completed, completes this CompletableFuture with a CancellationException.

Inherited from java.util.concurrent.CompletableFuture:
acceptEitheracceptEitherAsyncacceptEitherAsyncallOfanyOfapplyToEitherapplyToEitherAsyncapplyToEitherAsynccompletecompleteAsynccompleteAsynccompletedFuturecompletedStagecompleteExceptionallycompleteOnTimeoutcopydefaultExecutordelayedExecutordelayedExecutorexceptionallyexceptionallyAsyncexceptionallyAsyncexceptionallyComposeexceptionallyComposeAsyncexceptionallyComposeAsyncexceptionNowfailedFuturefailedStagegetgetgetNowgetNumberOfDependentshandlehandleAsynchandleAsyncisCancelledisCompletedExceptionallyisDonejoinminimalCompletionStagenewIncompleteFutureobtrudeExceptionobtrudeValueorTimeoutresultNowrunAfterBothrunAfterBothAsyncrunAfterBothAsyncrunAfterEitherrunAfterEitherAsyncrunAfterEitherAsyncrunAsyncrunAsyncstatesupplyAsyncsupplyAsyncthenAcceptthenAcceptAsyncthenAcceptAsyncthenAcceptBoththenAcceptBothAsyncthenAcceptBothAsyncthenApplythenApplyAsyncthenApplyAsyncthenCombinethenCombineAsyncthenCombineAsyncthenComposethenComposeAsyncthenComposeAsyncthenRunthenRunAsyncthenRunAsynctoCompletableFuturetoStringwhenCompletewhenCompleteAsyncwhenCompleteAsync

Field Detail

upstreamFutureback to summary
pack-priv volatile Future<?> upstreamFuture

Constructor Detail

CancellableCompletableFutureback to summary
private CancellableCompletableFuture()

Method Detail

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Overrides java.util.concurrent.CompletableFuture.cancel.

Implements java.util.concurrent.Future.cancel.

Doc from java.util.concurrent.CompletableFuture.cancel.

If not already completed, completes this CompletableFuture with a CancellationException. Dependent CompletableFutures that have not already completed will also complete exceptionally, with a CompletionException caused by this CancellationException.

Parameters
mayInterruptIfRunning:boolean

this value has no effect in this implementation because interrupts are not used to control processing.

Returns:boolean

true if this task is now cancelled

Annotations
@Override