Class AbstractMessageHandler

    • Constructor Detail

      • AbstractMessageHandler

        protected AbstractMessageHandler​(ExecutorService executorService)
    • Method Detail

      • handleChannelClosed

        public void handleChannelClosed​(org.jboss.remoting3.Channel closed,
                                        IOException e)
        Receive a notification that the channel was closed. This is used for the ManagementClientChannelStrategy.Establishing since it might use multiple channels.
        Parameters:
        closed - the closed resource
        e - the exception which occurred during close, if any
      • isShutdown

        protected boolean isShutdown()
        Is shutdown.
        Returns:
        true if the shutdown method was called, false otherwise
      • getExecutor

        protected ExecutorService getExecutor()
        Get the executor
        Returns:
        the executor
      • executeRequest

        protected <T,​A> org.jboss.threads.AsyncFuture<T> executeRequest​(ManagementRequest<T,​A> request,
                                                                              org.jboss.remoting3.Channel channel,
                                                                              ActiveOperation<T,​A> support)
        Execute a request.
        Parameters:
        request - the request
        channel - the channel
        support - the request support
        Returns:
        the future result
      • handleRequest

        protected <T,​A> void handleRequest​(org.jboss.remoting3.Channel channel,
                                                 DataInput message,
                                                 ManagementProtocolHeader header,
                                                 org.jboss.as.protocol.mgmt.AbstractMessageHandler.ActiveRequest<T,​A> activeRequest)
        Handle a message.
        Parameters:
        channel - the channel
        message - the message
        header - the protocol header
        activeRequest - the active request
      • handleMessage

        protected <T,​A> void handleMessage​(org.jboss.remoting3.Channel channel,
                                                 DataInput message,
                                                 ManagementProtocolHeader header,
                                                 ActiveOperation<T,​A> support,
                                                 ManagementRequestHandler<T,​A> handler)
        Handle a message.
        Parameters:
        channel - the channel
        message - the message
        header - the protocol header
        support - the request support
        handler - the request handler
      • handleClose

        public void handleClose​(org.jboss.remoting3.Channel closed,
                                IOException exception)
        Specified by:
        handleClose in interface org.jboss.remoting3.CloseHandler<org.jboss.remoting3.Channel>
      • registerActiveOperation

        protected <T,​A> ActiveOperation<T,​A> registerActiveOperation​(A attachment)
        Register an active operation. The operation-id will be generated.
        Parameters:
        attachment - the shared attachment
        Returns:
        the active operation
      • registerActiveOperation

        protected <T,​A> ActiveOperation<T,​A> registerActiveOperation​(A attachment,
                                                                                 ActiveOperation.CompletedCallback<T> callback)
        Register an active operation. The operation-id will be generated.
        Parameters:
        attachment - the shared attachment
        callback - the completed callback
        Returns:
        the active operation
      • registerActiveOperation

        protected <T,​A> ActiveOperation<T,​A> registerActiveOperation​(Integer id,
                                                                                 A attachment)
        Register an active operation with a specific operation id.
        Parameters:
        id - the operation id
        attachment - the shared attachment
        Returns:
        the created active operation
        Throws:
        IllegalStateException - if an operation with the same id is already registered
      • registerActiveOperation

        protected <T,​A> ActiveOperation<T,​A> registerActiveOperation​(Integer id,
                                                                                 A attachment,
                                                                                 ActiveOperation.CompletedCallback<T> callback)
        Register an active operation with a specific operation id.
        Parameters:
        id - the operation id
        attachment - the shared attachment
        callback - the completed callback
        Returns:
        the created active operation
        Throws:
        IllegalStateException - if an operation with the same id is already registered
      • getActiveOperation

        protected <T,​A> ActiveOperation<T,​A> getActiveOperation​(ManagementRequestHeader header)
        Get an active operation.
        Parameters:
        header - the request header
        Returns:
        the active operation, null if if there is no registered operation
      • getActiveOperation

        protected <T,​A> ActiveOperation<T,​A> getActiveOperation​(Integer id)
        Get the active operation.
        Parameters:
        id - the active operation id
        Returns:
        the active operation, null if if there is no registered operation
      • cancelAllActiveOperations

        protected List<Integer> cancelAllActiveOperations()
        Cancel all currently active operations.
        Returns:
        a list of cancelled operations
      • removeActiveOperation

        protected <T,​A> ActiveOperation<T,​A> removeActiveOperation​(Integer id)
        Remove an active operation.
        Parameters:
        id - the operation id
        Returns:
        the removed active operation, null if there was no registered operation
      • safeWriteErrorResponse

        protected static void safeWriteErrorResponse​(org.jboss.remoting3.Channel channel,
                                                     ManagementProtocolHeader header,
                                                     Throwable error)
        Safe write error response.
        Parameters:
        channel - the channel
        header - the request header
        error - the exception
      • writeErrorResponse

        protected static void writeErrorResponse​(org.jboss.remoting3.Channel channel,
                                                 ManagementRequestHeader header,
                                                 Throwable error)
                                          throws IOException
        Write an error response.
        Parameters:
        channel - the channel
        header - the request
        error - the error
        Throws:
        IOException