Class JMXNioServer

java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<JMXContext>
org.jppf.jmxremote.nio.JMXNioServer
All Implemented Interfaces:
Serializable, Runnable, JMXNioServerMBean

public final class JMXNioServer extends org.jppf.nio.StatelessNioServer<JMXContext> implements JMXNioServerMBean
The NIO server that handles client-side and server-side JMX connections.
Author:
Laurent Cohen
See Also:
  • Method Details

    • handleRead

      protected void handleRead(SelectionKey key) throws Exception
      Overrides:
      handleRead in class org.jppf.nio.StatelessNioServer<JMXContext>
      Throws:
      Exception
    • handleWrite

      protected void handleWrite(SelectionKey key) throws Exception
      Overrides:
      handleWrite in class org.jppf.nio.StatelessNioServer<JMXContext>
      Throws:
      Exception
    • handleSelectionException

      protected void handleSelectionException(SelectionKey key, Exception e)
      Specified by:
      handleSelectionException in class org.jppf.nio.StatelessNioServer<JMXContext>
    • accept

      public void accept(ServerSocketChannel serverSocketChannel, SocketChannel channel, org.jppf.nio.SSLHandler sslHandler, boolean ssl, boolean peer, Object... params)
      Specified by:
      accept in class org.jppf.nio.NioServer
    • createChannelsPair

      public ChannelsPair createChannelsPair(Map<String,?> env, String connectionID, int port, SocketChannel channel, boolean ssl, boolean client) throws Exception
      Create a pair of channels that can be used concurrently for the specified socket channel.
      Parameters:
      env - environment parameters to use for connector properties.
      connectionID - the server-sde connection ID.
      port - the server port that accepted the connection.
      channel - the associated socket channel.
      ssl - whether the connection is secure.
      client - whether the created channels are client-side (true) or server-side (false).
      Returns:
      a ChannelsPair instance.
      Throws:
      Exception - if any error occurs.
    • createNioContext

      public JMXContext createNioContext(Object... params)
      Specified by:
      createNioContext in class org.jppf.nio.NioServer
    • closeConnection

      public void closeConnection(ChannelsPair pair, Exception exception, boolean clientRequestedClose)
      Close a connection.
      Parameters:
      pair - .
      exception - optional exception that caused the connection close.
      clientRequestedClose - .
      Throws:
      Exception - if any error occurs.
    • removeAllConnections

      public void removeAllConnections()
      Overrides:
      removeAllConnections in class org.jppf.nio.NioServer
    • removeAllConnections

      public void removeAllConnections(int port)
      Remove and close all connections for the server with the specified port.
      Parameters:
      port - the port to which the connection was established.
    • addConnectionStatusListener

      public void addConnectionStatusListener(JMXConnectionStatusListener listener)
      Add a listener to the connection status events.
      Parameters:
      listener - the listener to add.
    • removeConnectionStatusListener

      public void removeConnectionStatusListener(JMXConnectionStatusListener listener)
      Remove a listener from the connection status events.
      Parameters:
      listener - the listener to remove.
    • getMessageHandlers

      public Map<String,JMXMessageHandler> getMessageHandlers(Collection<String> connectionIDs)
      Get a list of message handlers for the specified connection ids.
      Parameters:
      connectionIDs - the ids of the connections for which to get a message handler.
      Returns:
      a map of connection ids to their corresponding JMXMessageHandler, possibly empty.
    • stats

      public String stats()
      Description copied from interface: JMXNioServerMBean
      Provide some statistics about this sserver, for debug purposes.
      Specified by:
      stats in interface JMXNioServerMBean
      Returns:
      a map of statistics entries.
    • getStats

      public org.jppf.utils.stats.JPPFStatistics getStats()
      Returns:
      the statsistics to update, if any.
    • initReaderAndWriter

      protected void initReaderAndWriter()
      Specified by:
      initReaderAndWriter in class org.jppf.nio.StatelessNioServer<JMXContext>
    • initNioHandlers

      protected void initNioHandlers()
      Overrides:
      initNioHandlers in class org.jppf.nio.StatelessNioServer<JMXContext>
    • getPeakPendingMessages

      public int getPeakPendingMessages()
      Description copied from interface: JMXNioServerMBean
      Get the maximum number of pending notifications in the queue of a JMX connection.
      Specified by:
      getPeakPendingMessages in interface JMXNioServerMBean
      Returns:
      the peak queue size as an int.