Class JMXMessageHandler

java.lang.Object
org.jppf.jmxremote.message.JMXMessageHandler

public class JMXMessageHandler extends Object
Handles requests/responses and notifications with a message-based semantics.
Author:
Laurent Cohen
  • Field Details

    • CONNECTION_MESSAGE_ID

      public static final long CONNECTION_MESSAGE_ID
      Message ID for receiving a connection ID from the server.
      See Also:
  • Constructor Details

    • JMXMessageHandler

      public JMXMessageHandler(ChannelsPair channels, Map<String,?> env)
      Initialize with the specified pair of reading and writing channels.
      Parameters:
      channels - the associated pair of reading/writing channels.
      env - environment parameters to use for connector properties.
  • Method Details

    • getChannels

      public ChannelsPair getChannels()
      Returns:
      the NIO channels that perform the communication with the server.
    • sendRequestWithResponse

      public Object sendRequestWithResponse(byte type, Object... params) throws Exception
      Send a request and return a response when it arrives.
      Parameters:
      type - the type of request to send.
      params - the request's parameters.
      Returns:
      the result of the request.
      Throws:
      Exception - if any error occurs.
    • responseReceived

      public void responseReceived(JMXResponse response)
      Called when a response is received.
      Parameters:
      response - the repsonse to process.
    • sendRequestNoResponse

      public void sendRequestNoResponse(byte type, Object... params) throws Exception
      Sends the specified message.
      Parameters:
      type - the type of request to send.
      params - the request's parameters.
      Throws:
      Exception - if any error occurs.
    • messageSent

      public void messageSent(JMXMessage message)
      Called when a request that doesn't require a response is sent.
      Parameters:
      message - the request.
    • sendMessage

      public void sendMessage(JMXMessage message) throws Exception
      Sends the specified message.
      Parameters:
      message - the message to send.
      Throws:
      Exception - if any error occurs.
    • close

      public void close()
      Close this message handler.