Package org.jppf.nio

Class NioMessageReader<C extends AbstractNioContext>

java.lang.Object
org.jppf.nio.NioMessageReader<C>
Type Parameters:
C - the type of connection context.

public abstract class NioMessageReader<C extends AbstractNioContext> extends Object
Reads from the channel until no more data is available. Each fully read message is handed off to a global thread pool for deserialization and processing.
Author:
Laurent Cohen
  • Field Details

  • Constructor Details

    • NioMessageReader

      public NioMessageReader(StatelessNioServer<C> server)
      Initialize this message reader.
      Parameters:
      server - the nio server.
  • Method Details

    • read

      protected void read(C context) throws Exception
      Read from the channel until no more data is available (i.e. socket receive buffer is empty).
      Parameters:
      context - the JMX context that reads the data.
      Throws:
      Exception - if any error occurs.
    • getExecutor

      protected ExecutorService getExecutor()
      Returns:
      the exeuctor to use to handle messages.
    • createMessageHandler

      protected abstract NioMessageReader.MessageHandler<C> createMessageHandler()
      Create a handling task with the specified context and message.
      Returns:
      the created task.