Package org.infinispan.interceptors.impl
Class SimpleAsyncInvocationStage
- java.lang.Object
-
- org.infinispan.interceptors.InvocationStage
-
- org.infinispan.interceptors.impl.SimpleAsyncInvocationStage
-
- Direct Known Subclasses:
QueueAsyncInvocationStage
public class SimpleAsyncInvocationStage extends InvocationStage
Invocation stage representing a computation that may or may not be done yet. It is only meant to support the simplest asynchronous invocation,BaseAsyncInterceptor.asyncValue(CompletionStage).- Since:
- 9.0
- Author:
- Dan Berindei
-
-
Field Summary
Fields Modifier and Type Field Description protected CompletableFuture<Object>future
-
Constructor Summary
Constructors Constructor Description SimpleAsyncInvocationStage(CompletionStage<?> future)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C extends VisitableCommand>
ObjectaddCallback(InvocationContext ctx, C command, InvocationCallback<C> function)After the current stage completes, invokefunctionand return its result.Objectget()Wait for the invocation to complete and return its value.booleanisDone()ObjectthenReturn(InvocationContext ctx, VisitableCommand command, Object returnValue)Overrides the return value of thisInvocationStageif it is completed successfully.CompletableFuture<Object>toCompletableFuture()CompletableFutureconversion.StringtoString()-
Methods inherited from class org.infinispan.interceptors.InvocationStage
andExceptionally, andExceptionallyMakeStage, andFinally, andFinallyMakeStage, andHandle, andHandleMakeStage, completedNullStage, makeStage, thenAccept, thenAcceptMakeStage, thenApply, thenApplyMakeStage
-
-
-
-
Field Detail
-
future
protected final CompletableFuture<Object> future
-
-
Constructor Detail
-
SimpleAsyncInvocationStage
public SimpleAsyncInvocationStage(CompletionStage<?> future)
-
-
Method Detail
-
get
public Object get() throws Throwable
Description copied from class:InvocationStageWait for the invocation to complete and return its value.- Specified by:
getin classInvocationStage- Throws:
Throwable- Any exception raised during the invocation.
-
isDone
public boolean isDone()
- Specified by:
isDonein classInvocationStage- Returns:
trueif the invocation is complete.
-
toCompletableFuture
public CompletableFuture<Object> toCompletableFuture()
Description copied from class:InvocationStageCompletableFutureconversion.- Specified by:
toCompletableFuturein classInvocationStage
-
addCallback
public <C extends VisitableCommand> Object addCallback(InvocationContext ctx, C command, InvocationCallback<C> 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.- Specified by:
addCallbackin classInvocationStage
-
thenReturn
public Object thenReturn(InvocationContext ctx, VisitableCommand command, Object returnValue)
Description copied from class:InvocationStageOverrides the return value of thisInvocationStageif it is completed successfully. The result may be eitherrv, a newInvocationStageorthis- Overrides:
thenReturnin classInvocationStage
-
-