Class JMXContext

java.lang.Object
org.jppf.nio.AbstractNioContext
org.jppf.jmxremote.nio.JMXContext
All Implemented Interfaces:
org.jppf.nio.CloseableContext, org.jppf.nio.NioChannelHandler, org.jppf.nio.NioContext

public class JMXContext extends org.jppf.nio.AbstractNioContext
Context associated with a JMXChannelWrapper.
Author:
Laurent Cohen
  • Constructor Details

    • JMXContext

      public JMXContext(JMXNioServer server, boolean reading, SocketChannel socketChannel, Map<String,?> env)
      Initialize with the specified server.
      Parameters:
      server - the JMX nio server to use.
      socketChannel - the associated socket channel.
      reading - whether the associated channel performs read operations (true) or write operations (false).
      env - the jmx environment parameters.
  • Method Details

    • handleException

      public void handleException(Exception exception)
    • getConnectionID

      public String getConnectionID()
      Returns:
      the connection id.
    • deserializeMessage

      public JMXMessage deserializeMessage(org.jppf.nio.SimpleNioMessage message) throws Exception
      Deserialize the specified message.
      Parameters:
      message - the message to deserialize.
      Returns:
      a deserialzed message.
      Throws:
      Exception - if any error occurs.
    • offerJmxMessage

      public void offerJmxMessage(JMXMessage jmxMessage) throws Exception
      Add a JMX message to the pending queue.
      Parameters:
      jmxMessage - the JMX message to offer.
      Throws:
      Exception - if any error occurs.
    • pollJmxMessage

      public org.jppf.jmxremote.nio.MessageWrapper pollJmxMessage()
      Get the next JMX message from the pending queue.
      Returns:
      a JMXMessage instance.
    • hasQueuedMessage

      public boolean hasQueuedMessage()
      Returns:
      whether there is at least one pending message.
    • getMessageHandler

      public JMXMessageHandler getMessageHandler()
      Returns:
      the object that handles messages correlations.
    • getChannels

      public ChannelsPair getChannels()
      Returns:
      the ChannelsPair this context's channel is a part of.
    • setMessageHandler

      public void setMessageHandler(JMXMessageHandler messageHandler)
      Set the object that handles messages correlations.
      Parameters:
      messageHandler - a JMXMessageHandler instance.
    • toString

      public String toString()
      Overrides:
      toString in class org.jppf.nio.AbstractNioContext
    • getServer

      public JMXNioServer getServer()
      Returns:
      the JMX nio server to use.
    • getSelectionKey

      public SelectionKey getSelectionKey()
      Specified by:
      getSelectionKey in interface org.jppf.nio.NioChannelHandler
      Overrides:
      getSelectionKey in class org.jppf.nio.AbstractNioContext
      Returns:
      the channel's selection key.
    • readMessage

      public boolean readMessage() throws Exception
      Throws:
      Exception
    • writeMessage

      public boolean writeMessage() throws Exception
      Throws:
      Exception
    • getId

      public int getId()
      Returns:
      The unique id for this context.