Class AcceptorContext

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

public class AcceptorContext extends AbstractNioContext
Context associated with a channel serving tasks to a node.
Author:
Laurent Cohen
  • Constructor Details

    • AcceptorContext

      public AcceptorContext(AcceptorNioServer server, ServerSocketChannel serverSocketChannel, SocketChannel socketChannel, JPPFStatistics stats)
      Parameters:
      server - the acceptor server.
      serverSocketChannel - the server socket channel that accepted the connection.
      socketChannel - the socket channel that represent the connection.
      stats - the statsistics to update, if any.
  • Method Details

    • readMessage

      public boolean readMessage() throws Exception
      Read data from a channel. This method reads a single integer which identifies the type of the channel.
      Returns:
      true if all the data has been read, false otherwise.
      Throws:
      Exception - if an error occurs while reading the data.
      See Also:
    • handleException

      public void handleException(Exception e)
      Description copied from interface: NioContext
      Handle the cleanup when an exception occurs on the channel.
      Parameters:
      e - exception.
    • getId

      public int getId()
      get the identifier for the channel.
      Returns:
      the identifier as an int value.
    • getServerSocketChannel

      public ServerSocketChannel getServerSocketChannel()
      Returns:
      the server socket channel that accepted the connection.
    • writeMessage

      public boolean writeMessage() throws Exception
      Description copied from interface: NioContext
      Write data to a channel.
      Returns:
      true if all the data has been written, false otherwise.
      Throws:
      Exception - if an error occurs while writing the data.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractNioContext