Class ContainerProcessor

java.lang.Object
org.simpleframework.http.core.ContainerProcessor
All Implemented Interfaces:
Processor

public class ContainerProcessor extends Object implements Processor
The ContainerProcessor object is used to create channels which can be used to consume and process requests. This is basically an adapter to the Selector which will convert the provided transport to a usable channel. Each of the connected pipelines will end up at this object, regardless of whether those connections are SSL or plain data.
Author:
Niall Gallagher
  • Constructor Details

    • ContainerProcessor

      public ContainerProcessor(Container container, Allocator allocator, int count) throws IOException
      Constructor for the ContainerProcessor object. This is used to create a processor which will convert the provided transport objects to channels, which can then be processed by the selector and dispatched to the container.
      Parameters:
      container - the container to dispatch requests to
      allocator - this is the allocator used to buffer data
      count - this is the number of threads to be used
      Throws:
      IOException
    • ContainerProcessor

      public ContainerProcessor(Container container, Allocator allocator, int count, int select) throws IOException
      Constructor for the ContainerProcessor object. This is used to create a processor which will convert the provided transport objects to channels, which can then be processed by the selector and dispatched to the container.
      Parameters:
      container - the container to dispatch requests to
      allocator - this is the allocator used to buffer data
      count - this is the number of threads to be used
      select - this is the number of selector threads to use
      Throws:
      IOException
  • Method Details

    • process

      public void process(Transport transport) throws IOException
      This is used to process the requests from a provided transport and deliver a response to those requests. A transport can be a direct transport or a secure transport providing SSL.

      Typical usage of this method is to accept multiple transport objects, each representing a unique HTTP channel to the client, and process requests from those transports concurrently.

      Specified by:
      process in interface Processor
      Parameters:
      transport - the transport to process requests from
      Throws:
      IOException
    • stop

      public void stop() throws IOException
      This method is used to stop the Processor such that it will accept no more pipelines. Stopping the processor ensures that all resources occupied will be released. This is required so that all threads are stopped and released.

      Typically this method is called once all connections to the server have been stopped. As a final act of shutting down the entire server all threads must be stopped, this allows collection of unused memory and the closing of file and socket resources.

      Specified by:
      stop in interface Processor
      Throws:
      IOException