Class AsyncNodeClassNioServer

java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
org.jppf.server.nio.classloader.node.AsyncNodeClassNioServer
All Implemented Interfaces:
Runnable

public final class AsyncNodeClassNioServer extends org.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
The NIO server that handles asynchronous client connections, which can handle multiple jobs concurrently.
Author:
Laurent Cohen
  • Field Details

  • Constructor Details

    • AsyncNodeClassNioServer

      public AsyncNodeClassNioServer(JPPFDriver driver, int identifier, boolean useSSL) throws Exception
      Parameters:
      driver - reference to the driver.
      identifier - the channel identifier for channels handled by this server.
      useSSL - determines whether an SSLContext should be created for this server.
      Throws:
      Exception - if any error occurs.
  • Method Details

    • initReaderAndWriter

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

      protected void handleSelectionException(SelectionKey key, Exception e)
      Specified by:
      handleSelectionException in class org.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
    • 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
    • createNioContext

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

      public void closeConnection(AsyncNodeClassContext context)
      Close the specified channel.
      Parameters:
      context - the channel to close.
    • getNodeConnection

      public AsyncNodeClassContext getNodeConnection(String uuid)
      Get a channel from its uuid.
      Parameters:
      uuid - the uuid key to look up in the the map.
      Returns:
      channel the corresponding channel.
    • addNodeConnection

      public void addNodeConnection(String uuid, AsyncNodeClassContext channel)
      Put the specified uuid / channel pair into the uuid map.
      Parameters:
      uuid - the uuid key to add to the map.
      channel - the corresponding channel.
    • removeNodeConnection

      public org.jppf.classloader.AsyncLocalNodeClassloaderContext removeNodeConnection(String uuid)
      Remove the specified uuid entry from the uuid map.
      Parameters:
      uuid - the uuid key to remove from the map.
      Returns:
      channel the corresponding channel.
    • connectionFailed

      public void connectionFailed(AsyncNodeClassContext channel)
      Called when the node failed to respond to a heartbeat message.
      Parameters:
      channel - the channel to close.
    • removeAllConnections

      public void removeAllConnections()
      Close and remove all connections accepted by this server.
      Overrides:
      removeAllConnections in class org.jppf.nio.NioServer
      See Also:
      • NioServer.removeAllConnections()
    • getAllNodeConnections

      public List<AsyncNodeClassContext> getAllNodeConnections()
      Returns:
      the list of all current connections.
    • getResourceProvider

      public org.jppf.classloader.ResourceProvider getResourceProvider()
      Get the resource provider for this server.
      Returns:
      a ResourceProvider instance.
    • getMessageHandler

      public AsyncNodeClassMessageHandler getMessageHandler()
      Returns:
      the message handler for this server.
    • initNioHandlers

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