Package org.simpleframework.transport
Class ProcessorServer
- java.lang.Object
-
- org.simpleframework.transport.ProcessorServer
-
- All Implemented Interfaces:
Server
public class ProcessorServer extends java.lang.Object implements Server
TheProcessorServeris used to convert pipelines to transports. This simply acts as an adapter to a processor which converts a connected pipeline to aTransportwhich can be used to read and write data. Conversion of the pipeline is performed only once per connection.- Author:
- Niall Gallagher
-
-
Constructor Summary
Constructors Constructor Description ProcessorServer(Processor processor)Constructor for theProcessorServerobject.ProcessorServer(Processor processor, int count)Constructor for theProcessorServerobject.ProcessorServer(Processor processor, int count, int limit)Constructor for theProcessorServerobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprocess(Socket socket)Used to process thePipelinewhich is a full duplex communication link that may contain several HTTP requests.voidstop()This method is used to stop theProcessorsuch that it will accept no more pipelines.
-
-
-
Constructor Detail
-
ProcessorServer
public ProcessorServer(Processor processor) throws java.io.IOException
Constructor for theProcessorServerobject. The transport processor is used to process plain connections and wrap those connections in aTransportthat can be used to send and receive data to and from.- Parameters:
processor- this is used to process transports- Throws:
java.io.IOException
-
ProcessorServer
public ProcessorServer(Processor processor, int count) throws java.io.IOException
Constructor for theProcessorServerobject. The transport processor is used to process plain connections and wrap those connections in aTransportthat can be used to send and receive data to and from.- Parameters:
processor- this is used to process transportscount- this is the number of threads this will use- Throws:
java.io.IOException
-
ProcessorServer
public ProcessorServer(Processor processor, int count, int limit) throws java.io.IOException
Constructor for theProcessorServerobject. The transport processor is used to process plain connections and wrap those connections in aTransportthat can be used to send and receive data to and from.- Parameters:
processor- this is used to process transportscount- this is the number of threads this will uselimit- this is the threshold for asynchronous buffers- Throws:
java.io.IOException
-
-
Method Detail
-
process
public void process(Socket socket) throws java.io.IOException
Used to process thePipelinewhich is a full duplex communication link that may contain several HTTP requests. This will be used to read the requests from thePipelineand to pass these requests to aContainerfor 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.IOExceptionThis method is used to stop theProcessorsuch 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.
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.
-
-