Package org.jboss.as.protocol.mgmt
Interface ActiveOperation<T,A>
- Type Parameters:
T- the result typeA- 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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA callback indicating when an operation is complete.static interfaceHandler for the operation result or to mark the operation as cancelled or failed. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCancellable(org.xnio.Cancellable cancellable) Add a cancellation handler.Get the attachment.<U> CompletableFuture<U>getCompletableFuture(Function<T, U> transformer, Consumer<Boolean> asyncCancelTask) Get aCompletableFuturethat will provide a transformed operation result.Get the batch id.org.jboss.threads.AsyncFuture<T>Get anAsyncFuturethat will provide the operation result.Get the result handler for this request.
-
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 anAsyncFuturethat 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 aCompletableFuturethat will provide a transformed operation result.- Parameters:
transformer- function to transformer the operation result. Cannot benullasyncCancelTask- function to invoke trigger async cancellation ifis called. May benull, in which casedefault async cancellationis 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
-