public class ContainerServer extends java.lang.Object implements Server
ContainerServer
object provides a processor
that dispatch requests from a connected pipeline. SSL connections
and plain connections can be processed by this implementation. It
collects data from the connected pipelines and constructs the
requests and responses used to dispatch to the container.
In order to process the requests this uses two thread pools. One is used to collect data from the pipelines and create the requests. The other is used to service those requests. Such an architecture ensures that the serving thread does not have to deal with I/O operations. All data is consumed before it is serviced.
Constructor and Description |
---|
ContainerServer(Container container)
Constructor for the
ContainerServer object. |
ContainerServer(Container container,
Allocator allocator)
Constructor for the
ContainerServer object. |
ContainerServer(Container container,
Allocator allocator,
int count)
Constructor for the
ContainerServer object. |
ContainerServer(Container container,
int count)
Constructor for the
ContainerServer object. |
public ContainerServer(Container container) throws java.io.IOException
ContainerServer
object. The
processor created will collect HTTP requests from the pipelines
provided and dispatch those requests to the provided container.container
- this is the container used to service requestsjava.io.IOException
public ContainerServer(Container container, int count) throws java.io.IOException
ContainerServer
object. The
processor created will collect HTTP requests from the pipelines
provided and dispatch those requests to the provided container.container
- this is the container used to service requestscount
- this is the number of threads used for each pooljava.io.IOException
public ContainerServer(Container container, Allocator allocator) throws java.io.IOException
ContainerServer
object. The
processor created will collect HTTP requests from the pipelines
provided and dispatch those requests to the provided container.container
- this is the container used to service requestsallocator
- this is the allocator used to create buffersjava.io.IOException
public ContainerServer(Container container, Allocator allocator, int count) throws java.io.IOException
ContainerServer
object. The
processor created will collect HTTP requests from the pipelines
provided and dispatch those requests to the provided container.container
- this is the container used to service requestsallocator
- this is the allocator used to create bufferscount
- this is the number of threads used for each pooljava.io.IOException
public void process(Socket socket) throws java.io.IOException
Socket
which is a full duplex
communication link that may contain several HTTP requests. This
will be used to read the requests from the Socket
and to pass these requests to a Container
for
processing.
Typical usage of this method is to accept multiple pipeline objects, each representing a unique HTTP channel to the client, and process requests from those pipelines concurrently.
public void stop() throws java.io.IOException
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 all memory is 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.