Interface ActiveOperation<T,A>

Type Parameters:
T - the result type
A - the attachment type

public interface ActiveOperation<T,A>
Encapsulates information about a currently active operation, which can require multiple messages exchanged between the client and the server.

An attachment is optional, but can be used to maintain a shared state between multiple requests. It can be accessed using the ManagementRequestContext.getAttachment() from the request handler.

An operation is seen as active until one of the methods on the ActiveOperation.ResultHandler are called.

Author:
Emanuel Muckenhuber
  • Method Details

    • getOperationId

      Integer getOperationId()
      Get the batch id.
      Returns:
      the batch id
    • getResultHandler

      ActiveOperation.ResultHandler<T> getResultHandler()
      Get the result handler for this request.
      Returns:
      the result handler
    • getAttachment

      A getAttachment()
      Get the attachment.
      Returns:
      the attachment
    • getResult

      org.jboss.threads.AsyncFuture<T> getResult()
      Get an AsyncFuture that will provide the operation result.
      Returns:
      the future result. Will not return null
    • getCompletableFuture

      <U> CompletableFuture<U> getCompletableFuture(Function<T,U> transformer, Consumer<Boolean> asyncCancelTask)
      Get a CompletableFuture that will provide a transformed operation result.
      Parameters:
      transformer - function to transformer the operation result. Cannot be null
      asyncCancelTask - function to invoke trigger async cancellation if is called. May be null, in which case default async cancellation is used.
      Returns:
      the future result. Will not return null
    • addCancellable

      void addCancellable(org.xnio.Cancellable cancellable)
      Add a cancellation handler.
      Parameters:
      cancellable - the cancel handler