Class ContainerServer
- All Implemented Interfaces:
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.
- Author:
- Niall Gallagher
-
Constructor Summary
ConstructorsConstructorDescriptionContainerServer
(Container container) Constructor for theContainerServer
object.ContainerServer
(Container container, int count) Constructor for theContainerServer
object.ContainerServer
(Container container, Allocator allocator) Constructor for theContainerServer
object.ContainerServer
(Container container, Allocator allocator, int count) Constructor for theContainerServer
object. -
Method Summary
-
Constructor Details
-
ContainerServer
Constructor for theContainerServer
object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.- Parameters:
container
- this is the container used to service requests- Throws:
IOException
-
ContainerServer
Constructor for theContainerServer
object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.- Parameters:
container
- this is the container used to service requestscount
- this is the number of threads used for each pool- Throws:
IOException
-
ContainerServer
Constructor for theContainerServer
object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.- Parameters:
container
- this is the container used to service requestsallocator
- this is the allocator used to create buffers- Throws:
IOException
-
ContainerServer
Constructor for theContainerServer
object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.- Parameters:
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 pool- Throws:
IOException
-
-
Method Details
-
process
Used to process theSocket
which is a full duplex communication link that may contain several HTTP requests. This will be used to read the requests from theSocket
and to pass these requests to aContainer
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.
- Specified by:
process
in interfaceServer
- Parameters:
socket
- this is the connected HTTP pipeline to process- Throws:
IOException
-
stop
This method is used to stop theProcessor
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.
- Specified by:
stop
in interfaceServer
- Throws:
IOException
-