Package org.jboss.as.protocol.mgmt
Class ManagementChannelHandler
java.lang.Object
org.jboss.as.protocol.mgmt.AbstractMessageHandler
org.jboss.as.protocol.mgmt.ManagementChannelHandler
- All Implemented Interfaces:
EventListener,ManagementChannelAssociation,ManagementMessageHandler,ManagementChannelShutdownHandle,org.jboss.remoting3.CloseHandler<org.jboss.remoting3.Channel>
public final class ManagementChannelHandler
extends AbstractMessageHandler
implements ManagementChannelAssociation
Generic management channel handler allowing to assemble multiple
ManagementRequestHandlerFactory per channel.- Author:
- Emanuel Muckenhuber
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService) ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService, ManagementRequestHandlerFactory... initial) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a management request handler factory to this context.<T,A> org.jboss.threads.AsyncFuture<T> executeRequest(Integer operationId, ManagementRequest<T, A> request) Execute a request based on an existing active operation.<T,A> org.jboss.threads.AsyncFuture<T> executeRequest(ActiveOperation<T, A> support, ManagementRequest<T, A> request) Execute a request based on an existing active operation.<T,A> ActiveOperation<T, A> executeRequest(ManagementRequest<T, A> request, A attachment) Execute a management request.<T,A> ActiveOperation<T, A> executeRequest(ManagementRequest<T, A> request, A attachment, ActiveOperation.CompletedCallback<T> callback) Execute a management request.org.jboss.remoting3.AttachmentsGet the attachments object that can be used to share state between users of this object.org.jboss.remoting3.ChannelGet the underlying remoting channel associated with this context.longorg.jboss.remoting3.Channel.ReceiverGet a receiver instance for this context.Get the remote address.protected ManagementRequestHandler<?,?> Get the request handler.<T,A> ActiveOperation<T, A> initializeOperation(A attachment, ActiveOperation.CompletedCallback<T> callback) Initialize a newActiveOperation, for subsequent use withManagementChannelAssociation.executeRequest(ActiveOperation, ManagementRequest).booleanRemove a management request handler factory from this context.Methods inherited from class org.jboss.as.protocol.mgmt.AbstractMessageHandler
awaitCompletion, cancelAllActiveOperations, executeRequest, getActiveOperation, getActiveOperation, getExecutor, getFallbackHandler, handleChannelClosed, handleClose, handleMessage, handleMessage, handleMessage, isShutdown, registerActiveOperation, registerActiveOperation, registerActiveOperation, registerActiveOperation, removeActiveOperation, safeWriteErrorResponse, shutdown, shutdownNow, validateRequest, writeErrorResponse, writeHeader
-
Field Details
-
TEMP_DIR
Optional attachment for a temp file directory.
-
-
Constructor Details
-
ManagementChannelHandler
public ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService) -
ManagementChannelHandler
public ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService, ManagementRequestHandlerFactory... initial)
-
-
Method Details
-
getLastMessageReceivedTime
public long getLastMessageReceivedTime() -
getChannel
Get the underlying remoting channel associated with this context.- Specified by:
getChannelin interfaceManagementChannelAssociation- Returns:
- the channel
- Throws:
IOException- if a problem occurs obtaining the channel
-
getRemoteAddress
Get the remote address.- Returns:
- the remote address,
nullif not available
-
initializeOperation
public <T,A> ActiveOperation<T,A> initializeOperation(A attachment, ActiveOperation.CompletedCallback<T> callback) Description copied from interface:ManagementChannelAssociationInitialize a newActiveOperation, for subsequent use withManagementChannelAssociation.executeRequest(ActiveOperation, ManagementRequest).- Specified by:
initializeOperationin interfaceManagementChannelAssociation- Type Parameters:
T- the result typeA- the attachment type- Parameters:
attachment- the attachmentcallback- the completion listener- Returns:
- the created active operation
-
executeRequest
public <T,A> ActiveOperation<T,A> executeRequest(ManagementRequest<T, A> request, A attachment, ActiveOperation.CompletedCallback<T> callback) throws IOExceptionExecute a management request.- Specified by:
executeRequestin interfaceManagementChannelAssociation- Type Parameters:
T- the result typeA- the attachment type- Parameters:
request- the requestattachment- the attachmentcallback- the completion listener- Returns:
- the created active operation
- Throws:
IOException- if a problem occurs executing the request
-
executeRequest
public <T,A> ActiveOperation<T,A> executeRequest(ManagementRequest<T, A> request, A attachment) throws IOExceptionExecute a management request.- Specified by:
executeRequestin interfaceManagementChannelAssociation- Type Parameters:
T- the result typeA- the attachment type- Parameters:
request- the requestattachment- the attachment- Returns:
- the created active operation
- Throws:
IOException- if a problem occurs executing the request
-
executeRequest
public <T,A> org.jboss.threads.AsyncFuture<T> executeRequest(Integer operationId, ManagementRequest<T, A> request) throws IOExceptionExecute a request based on an existing active operation.- Specified by:
executeRequestin interfaceManagementChannelAssociation- Type Parameters:
T- the request typeA- the attachment type- Parameters:
operationId- the operation-id of the existing active operationrequest- the request- Returns:
- the future result
- Throws:
IOException- if a problem occurs executing the request
-
executeRequest
public <T,A> org.jboss.threads.AsyncFuture<T> executeRequest(ActiveOperation<T, A> support, ManagementRequest<T, throws IOExceptionA> request) Execute a request based on an existing active operation.- Specified by:
executeRequestin interfaceManagementChannelAssociation- Type Parameters:
T- the result typeA- the attachment type- Parameters:
support- the active operationrequest- the request- Returns:
- the future result
- Throws:
IOException- if a problem occurs executing the request
-
getRequestHandler
Get the request handler.- Overrides:
getRequestHandlerin classAbstractMessageHandler- Parameters:
header- the request header- Returns:
- the request handler
-
getReceiver
public org.jboss.remoting3.Channel.Receiver getReceiver()Get a receiver instance for this context.- Returns:
- the receiver
-
getAttachments
public org.jboss.remoting3.Attachments getAttachments()Description copied from interface:ManagementChannelAssociationGet the attachments object that can be used to share state between users of this object.- Specified by:
getAttachmentsin interfaceManagementChannelAssociation- Returns:
- the attachments
-
addHandlerFactory
Add a management request handler factory to this context.- Parameters:
factory- the request handler to add
-
removeHandlerFactory
Remove a management request handler factory from this context.- Parameters:
instance- the request handler factory- Returns:
trueif the instance was removed,falseotherwise
-