Class TransportSocketProcessor

java.lang.Object
org.simpleframework.transport.TransportSocketProcessor
All Implemented Interfaces:
SocketProcessor

public class TransportSocketProcessor extends Object implements SocketProcessor
The TransportSocketProcessor is used to convert sockets to transports. This acts as an adapter to a transport processor which converts a connected socket to a Transport that can be used to read and write data. Depending on whether there is an SSLEngine associated with the socket or not, there could be an SSL handshake performed.
  • Field Details

    • executor

      private final ConcurrentExecutor executor
      This is the executor used to execute the I/O operations.
    • factory

      private final OperationFactory factory
      This is the factory used to create the required operations.
    • reactor

      private final Reactor reactor
      This is the processor used to process transport objects.
    • cleaner

      private final Daemon cleaner
      This is used to clean the internals of the processor.
  • Constructor Details

    • TransportSocketProcessor

      public TransportSocketProcessor(TransportProcessor processor) throws IOException
      Constructor for the TransportSocketProcessor object. The transport processor is used to process plain connections and wrap those connections in a Transport that can be used to send and receive data to and from.
      Parameters:
      processor - this is used to process transports
      Throws:
      IOException
    • TransportSocketProcessor

      public TransportSocketProcessor(TransportProcessor processor, int threads) throws IOException
      Constructor for the TransportSocketProcessor object. The transport processor is used to process plain connections and wrap those connections in a Transport that can be used to send and receive data to and from.
      Parameters:
      processor - this is used to process transports
      threads - this is the number of threads this will use
      Throws:
      IOException
    • TransportSocketProcessor

      public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer) throws IOException
      Constructor for the TransportSocketProcessor object. The transport processor is used to process plain connections and wrap those connections in a Transport that can be used to send and receive data to and from.
      Parameters:
      processor - this is used to process transports
      threads - this is the number of threads this will use
      buffer - this is the initial size of the output buffer
      Throws:
      IOException
    • TransportSocketProcessor

      public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold) throws IOException
      Constructor for the TransportSocketProcessor object. The transport processor is used to process plain connections and wrap those connections in a Transport that can be used to send and receive data to and from.
      Parameters:
      processor - this is used to process transports
      threads - this is the number of threads this will use
      buffer - this is the initial size of the output buffer
      threshold - this is the maximum size of the output buffer
      Throws:
      IOException
    • TransportSocketProcessor

      public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold, boolean client) throws IOException
      Constructor for the TransportSocketProcessor object. The transport processor is used to process plain connections and wrap those connections in a Transport that can be used to send and receive data to and from.
      Parameters:
      processor - this is used to process transports
      threads - this is the number of threads this will use
      buffer - this is the initial size of the output buffer
      threshold - this is the maximum size of the output buffer
      client - determines if the SSL handshake is for a client
      Throws:
      IOException
  • Method Details

    • process

      public void process(Socket socket) throws IOException
      Used to connect the Socket which is a full duplex TCP connection to a higher layer the application. It is this layer that is responsible for interpreting a protocol or handling messages in some manner. In the case of HTTP this will initiate the consumption of a HTTP request after any SSL handshake is finished if the connection is secure.
      Specified by:
      process in interface SocketProcessor
      Parameters:
      socket - this is the connected HTTP pipeline to process
      Throws:
      IOException
    • stop

      public void stop() throws IOException
      This is implemented to shut down the server asynchronously. It will start a process to perform the shutdown. Asynchronous shutdown allows a server resource executed via a HTTP request can stop the server without any danger of killing itself or even worse causing a deadlock.
      Specified by:
      stop in interface SocketProcessor
      Throws:
      IOException