Package org.infinispan.interceptors.impl
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 void
accept(Object rv, Throwable throwable)
Object
addCallback(InvocationContext ctx, VisitableCommand command, InvocationCallback function)
Object
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.String
toString()
-
Methods inherited from class org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
get, isDone, toCompletableFuture
-
Methods inherited from class org.infinispan.interceptors.InvocationStage
andExceptionally, andFinally, andHandle, thenAccept, thenApply
-
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)
- Overrides:
addCallback
in classSimpleAsyncInvocationStage
-
accept
public void accept(Object rv, Throwable throwable)
- Specified by:
accept
in interfaceBiConsumer<Object,Throwable>
-
apply
public Object apply(InvocationContext rCtx, VisitableCommand rCommand, Object rv, Throwable throwable) throws Throwable
Description copied from interface:InvocationCallback
Process the result or the exception from an invocation stage and either return a simple value, return a newInvocationStage
, or throw an exception.- Specified by:
apply
in interfaceInvocationCallback
- Throws:
Throwable
-
toString
public String toString()
- Overrides:
toString
in classSimpleAsyncInvocationStage
-
-