Class AsyncClientClassNioServer

java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<AsyncClientClassContext>
org.jppf.server.nio.classloader.client.AsyncClientClassNioServer
All Implemented Interfaces:
Runnable

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

    • AsyncClientClassNioServer

      public AsyncClientClassNioServer(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<AsyncClientClassContext>
    • handleSelectionException

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

      public void closeConnection(AsyncClientClassContext channel)
      Close the specified connection.
      Parameters:
      channel - the channel representing the connection.
    • closeConnection

      public void closeConnection(AsyncClientClassContext context, boolean removeJobConnection)
      Close the specified connection.
      Parameters:
      context - the channel representing the connection.
      removeJobConnection - true to remove the corresponding job connection as well, false otherwise.
    • addProviderConnection

      public void addProviderConnection(String uuid, AsyncClientClassContext context)
      Add a provider connection to the map of existing available providers.
      Parameters:
      uuid - the provider uuid as a string.
      context - the provider's communication channel.
    • removeProviderConnection

      public void removeProviderConnection(String uuid, AsyncClientClassContext context)
      Add a provider connection to the map of existing available providers.
      Parameters:
      uuid - the provider uuid as a string.
      context - the provider's communication channel.
    • getProviderConnections

      public List<AsyncClientClassContext> getProviderConnections(String uuid)
      Get all the provider connections for the specified client uuid.
      Parameters:
      uuid - the uuid of the client for which to get connections.
      Returns:
      a list of connection channels.
    • removeProviderConnections

      public void removeProviderConnections(String uuid)
      Remove all the provider connections for the specified client uuid.
      Parameters:
      uuid - the uuid of the client for which to remove connections.
    • getAllProviderConnections

      public List<AsyncClientClassContext> getAllProviderConnections()
      Get all the provider connections handled by this server.
      Returns:
      a list of connection channels.
    • removeAllConnections

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

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

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

      public JPPFDriver getDriver()
      Returns:
      a reference to the driver.
    • getClassCache

      public ClassCache getClassCache()
      Returns:
      the cache of class definitions.