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 multipleManagementRequestHandlerFactoryper channel.- Author:
- Emanuel Muckenhuber
-
-
Constructor Summary
Constructors Constructor Description ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService)ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService, ManagementRequestHandlerFactory... initial)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHandlerFactory(ManagementRequestHandlerFactory factory)Add 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.AttachmentsgetAttachments()Get the attachments object that can be used to share state between users of this object.org.jboss.remoting3.ChannelgetChannel()Get the underlying remoting channel associated with this context.longgetLastMessageReceivedTime()org.jboss.remoting3.Channel.ReceivergetReceiver()Get a receiver instance for this context.InetAddressgetRemoteAddress()Get the remote address.protected ManagementRequestHandler<?,?>getRequestHandler(ManagementRequestHeader header)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).booleanremoveHandlerFactory(ManagementRequestHandlerFactory instance)Remove 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, handleRequest, isShutdown, registerActiveOperation, registerActiveOperation, registerActiveOperation, registerActiveOperation, removeActiveOperation, safeWriteErrorResponse, shutdown, shutdownNow, validateRequest, writeErrorResponse, writeHeader
-
-
-
-
Field Detail
-
TEMP_DIR
public static final org.jboss.remoting3.Attachments.Key<File> TEMP_DIR
Optional attachment for a temp file directory.
-
-
Constructor Detail
-
ManagementChannelHandler
public ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService)
-
ManagementChannelHandler
public ManagementChannelHandler(ManagementClientChannelStrategy strategy, ExecutorService executorService, ManagementRequestHandlerFactory... initial)
-
-
Method Detail
-
getLastMessageReceivedTime
public long getLastMessageReceivedTime()
-
getChannel
public org.jboss.remoting3.Channel getChannel() throws IOExceptionGet the underlying remoting channel associated with this context.- Specified by:
getChannelin interfaceManagementChannelAssociation- Returns:
- the channel
- Throws:
IOException
-
getRemoteAddress
public InetAddress 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) throws IOException
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
- Throws:
IOException
-
executeRequest
public <T,A> ActiveOperation<T,A> executeRequest(ManagementRequest<T,A> request, A attachment, ActiveOperation.CompletedCallback<T> callback) throws IOException
Execute 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
-
executeRequest
public <T,A> ActiveOperation<T,A> executeRequest(ManagementRequest<T,A> request, A attachment) throws IOException
Execute 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
-
executeRequest
public <T,A> org.jboss.threads.AsyncFuture<T> executeRequest(Integer operationId, ManagementRequest<T,A> request) throws IOException
Execute 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
-
executeRequest
public <T,A> org.jboss.threads.AsyncFuture<T> executeRequest(ActiveOperation<T,A> support, ManagementRequest<T,A> request) throws IOException
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
-
getRequestHandler
protected ManagementRequestHandler<?,?> getRequestHandler(ManagementRequestHeader header)
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
public void addHandlerFactory(ManagementRequestHandlerFactory factory)
Add a management request handler factory to this context.- Parameters:
factory- the request handler to add
-
removeHandlerFactory
public boolean removeHandlerFactory(ManagementRequestHandlerFactory instance)
Remove a management request handler factory from this context.- Parameters:
instance- the request handler factory- Returns:
trueif the instance was removed,falseotherwise
-
-