Class ContainerServer
- java.lang.Object
-
- org.simpleframework.http.core.ContainerServer
-
- All Implemented Interfaces:
Server
public class ContainerServer extends java.lang.Object implements Server
TheContainerServer
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
Constructors Constructor Description ContainerServer(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
process(Socket socket)
Used to process theSocket
which is a full duplex communication link that may contain several HTTP requests.void
stop()
This method is used to stop theProcessor
such that it will accept no more pipelines.
-
-
-
Constructor Detail
-
ContainerServer
public ContainerServer(Container container) throws java.io.IOException
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:
java.io.IOException
-
ContainerServer
public ContainerServer(Container container, int count) throws java.io.IOException
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:
java.io.IOException
-
ContainerServer
public ContainerServer(Container container, Allocator allocator) throws java.io.IOException
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:
java.io.IOException
-
ContainerServer
public ContainerServer(Container container, Allocator allocator, int count) throws java.io.IOException
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:
java.io.IOException
-
-
Method Detail
-
process
public void process(Socket socket) throws java.io.IOException
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.
-
stop
public void stop() throws java.io.IOException
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.
-
-