Class QueueAsyncInvocationStage
- java.lang.Object
-
- org.infinispan.interceptors.InvocationStage
-
- org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
-
- org.infinispan.interceptors.impl.QueueAsyncInvocationStage
-
- All Implemented Interfaces:
BiConsumer<Object,Throwable>,InvocationCallback
public class QueueAsyncInvocationStage extends SimpleAsyncInvocationStage implements BiConsumer<Object,Throwable>, InvocationCallback
Invocation stage representing a computation that may or may not be done yet.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 regularCompletableFuture.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
Constructors Constructor Description QueueAsyncInvocationStage(InvocationContext ctx, VisitableCommand command, CompletableFuture<?> valueFuture, InvocationCallback function)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Object rv, Throwable throwable)ObjectaddCallback(InvocationContext ctx, VisitableCommand command, InvocationCallback function)After the current stage completes, invokefunctionand return its result.Objectapply(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.StringtoString()-
Methods inherited from class org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
get, isDone, thenReturn, toCompletableFuture
-
Methods inherited from class org.infinispan.interceptors.InvocationStage
andExceptionally, andExceptionallyMakeStage, andFinally, andFinallyMakeStage, andHandle, andHandleMakeStage, completedNullStage, makeStage, thenAccept, thenAcceptMakeStage, thenApply, thenApplyMakeStage
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Constructor Detail
-
QueueAsyncInvocationStage
public QueueAsyncInvocationStage(InvocationContext ctx, VisitableCommand command, CompletableFuture<?> valueFuture, InvocationCallback function)
-
-
Method Detail
-
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
public void accept(Object rv, Throwable throwable)
- 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
public String toString()
- Overrides:
toStringin classSimpleAsyncInvocationStage
-
-