Class 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 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