Class BaseAsyncInterceptor

    • Field Detail

    • Constructor Detail

      • BaseAsyncInterceptor

        public BaseAsyncInterceptor()
    • Method Detail

      • invokeNextThenApply

        public final java.lang.Object invokeNextThenApply​(InvocationContext ctx,
                                                          org.infinispan.commands.VisitableCommand command,
                                                          InvocationSuccessFunction function)
        Invoke the next interceptor, possibly with a new command, and execute an InvocationCallback after all the interceptors have finished successfully.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • invokeNextThenAccept

        public final java.lang.Object invokeNextThenAccept​(InvocationContext ctx,
                                                           org.infinispan.commands.VisitableCommand command,
                                                           InvocationSuccessAction action)
        Invoke the next interceptor, possibly with a new command, and execute an InvocationCallback after all the interceptors have finished successfully.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • invokeNextAndExceptionally

        public final java.lang.Object invokeNextAndExceptionally​(InvocationContext ctx,
                                                                 org.infinispan.commands.VisitableCommand command,
                                                                 InvocationExceptionFunction function)
        Invoke the next interceptor, possibly with a new command, and execute an InvocationCallback after all the interceptors have finished with an exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • invokeNextAndFinally

        public final java.lang.Object invokeNextAndFinally​(InvocationContext ctx,
                                                           org.infinispan.commands.VisitableCommand command,
                                                           InvocationFinallyAction action)
        Invoke the next interceptor, possibly with a new command, and execute an InvocationCallback after all the interceptors have finished, with or without an exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • invokeNextAndHandle

        public final java.lang.Object invokeNextAndHandle​(InvocationContext ctx,
                                                          org.infinispan.commands.VisitableCommand command,
                                                          InvocationFinallyFunction function)
        Invoke the next interceptor, possibly with a new command, and execute an InvocationCallback after all the interceptors have finished, with or without an exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • asyncValue

        public static InvocationStage asyncValue​(java.util.concurrent.CompletionStage<?> valueFuture)
        Suspend the invocation until valueFuture completes, then return its result without running the remaining interceptors.

        The caller can add a callback that will run when valueFuture completes, e.g. asyncValue(v).thenApply(ctx, command, (rCtx, rCommand, rv, t) -> invokeNext(rCtx, rCommand)). For this particular scenario, however, it's simpler to use asyncInvokeNext(InvocationContext, VisitableCommand, CompletionStage).

      • asyncInvokeNext

        public final java.lang.Object asyncInvokeNext​(InvocationContext ctx,
                                                      org.infinispan.commands.VisitableCommand command,
                                                      java.util.concurrent.CompletionStage<?> delay)
        Suspend the invocation until delay completes, then if successful invoke the next interceptor.

        If delay completes exceptionally, skip the next interceptor and continue with the exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • asyncInvokeNext

        public final java.lang.Object asyncInvokeNext​(InvocationContext ctx,
                                                      org.infinispan.commands.VisitableCommand command,
                                                      InvocationStage invocationStage)
        Suspend the invocation until invocationStage completes, then if successful invoke the next interceptor.

        If invocationStage completes exceptionally, skip the next interceptor and continue with the exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • asyncInvokeNext

        public final java.lang.Object asyncInvokeNext​(InvocationContext ctx,
                                                      org.infinispan.commands.VisitableCommand command,
                                                      java.util.Collection<? extends java.util.concurrent.CompletionStage<?>> delays)
        Suspend invocation until all delays complete, then if successful invoke the next interceptor. If the list is empty or null, invoke the next interceptor immediately.

        If any of delays completes exceptionally, skip the next interceptor and continue with the exception.

        You need to wrap the result with makeStage(Object) if you need to add another handler.

      • valueOrException

        public static java.lang.Object valueOrException​(java.lang.Object rv,
                                                        java.lang.Throwable throwable)
                                                 throws java.lang.Throwable
        Return the value if throwable != null, throw the exception otherwise.
        Throws:
        java.lang.Throwable
      • delayedValue

        public static java.lang.Object delayedValue​(java.util.concurrent.CompletionStage<?> stage,
                                                    java.lang.Object syncValue)
        Returns an InvocationStage if the provided CompletionStage is null, not completed or completed via exception. If these are not true the sync value is returned directly.
        Parameters:
        stage - wait for completion of this if not null
        syncValue - sync value to return if stage is complete or as stage value
        Returns:
        invocation stage or sync value
      • delayedValue

        public static java.lang.Object delayedValue​(java.util.concurrent.CompletionStage<?> stage,
                                                    java.lang.Object syncValue,
                                                    java.lang.Throwable throwable)
        This method should be used instead of delayedValue(CompletionStage, Object) when a InvocationFinallyFunction is used to properly handle the exception if any is present.
        Parameters:
        stage -
        syncValue -
        throwable -
        Returns:
      • isSuccessfullyDone

        protected static boolean isSuccessfullyDone​(java.lang.Object maybeStage)