Class QueueAsyncInvocationStage
- All Implemented Interfaces:
BiConsumer<Object,,Throwable> InvocationCallback
It stores handler objects in a queue instead of creating a new instance every time a handler is added.
The queue may be frozen based on internal conditions, like executing the last handler or reaching the capacity
of the queue, and adding a handler will create a new instance.
The queue will also be frozen when SimpleAsyncInvocationStage.toCompletableFuture() is invoked, to make that future behave like
a regular CompletableFuture.
When the queue is not frozen, adding a handler will change the result of the current stage. When the queue is frozen, adding a handler may actually execute the handler synchronously.
- Since:
- 9.0
- Author:
- Dan Berindei
-
Field Summary
Fields inherited from class org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
future -
Constructor Summary
ConstructorsConstructorDescriptionQueueAsyncInvocationStage(InvocationContext ctx, VisitableCommand command, CompletableFuture<?> valueFuture, InvocationCallback function) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(InvocationContext ctx, VisitableCommand command, InvocationCallback function) After the current stage completes, invokefunctionand return its result.apply(InvocationContext rCtx, VisitableCommand rCommand, Object rv, Throwable throwable) Process the result or the exception from an invocation stage and either return a simple value, return a newInvocationStage, or throw an exception.toString()Methods inherited from class org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
get, isDone, thenReturn, toCompletableFutureMethods inherited from class org.infinispan.interceptors.InvocationStage
andExceptionally, andExceptionallyMakeStage, andFinally, andFinallyMakeStage, andHandle, andHandleMakeStage, completedFalseStage, completedNullStage, completedTrueStage, makeStage, thenAccept, thenAcceptMakeStage, thenApply, thenApplyMakeStageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.BiConsumer
andThen
-
Constructor Details
-
QueueAsyncInvocationStage
public QueueAsyncInvocationStage(InvocationContext ctx, VisitableCommand command, CompletableFuture<?> valueFuture, InvocationCallback function)
-
-
Method Details
-
addCallback
public Object addCallback(InvocationContext ctx, VisitableCommand command, InvocationCallback function) Description copied from class:InvocationStageAfter the current stage completes, invokefunctionand return its result.The result may be either a plain value, or a new
InvocationStage. Iffunctionthrows an exception, the resultInvocationStagewill complete with the same exception.- Overrides:
addCallbackin classSimpleAsyncInvocationStage
-
accept
- Specified by:
acceptin interfaceBiConsumer<Object,Throwable>
-
apply
public Object apply(InvocationContext rCtx, VisitableCommand rCommand, Object rv, Throwable throwable) throws Throwable Description copied from interface:InvocationCallbackProcess the result or the exception from an invocation stage and either return a simple value, return a newInvocationStage, or throw an exception.- Specified by:
applyin interfaceInvocationCallback- Throws:
Throwable
-
toString
- Overrides:
toStringin classSimpleAsyncInvocationStage
-