Package org.simpleframework.transport
Class TransportSocketProcessor
- java.lang.Object
-
- org.simpleframework.transport.TransportSocketProcessor
-
- All Implemented Interfaces:
SocketProcessor
public class TransportSocketProcessor extends java.lang.Object implements SocketProcessor
TheTransportSocketProcessor
is used to convert sockets to transports. This acts as an adapter to a transport processor which converts a connected socket to aTransport
that can be used to read and write data. Depending on whether there is anSSLEngine
associated with the socket or not, there could be an SSL handshake performed.- Author:
- Niall Gallagher
-
-
Constructor Summary
Constructors Constructor Description TransportSocketProcessor(TransportProcessor processor)
Constructor for theTransportSocketProcessor
object.TransportSocketProcessor(TransportProcessor processor, int threads)
Constructor for theTransportSocketProcessor
object.TransportSocketProcessor(TransportProcessor processor, int threads, int buffer)
Constructor for theTransportSocketProcessor
object.TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold)
Constructor for theTransportSocketProcessor
object.TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold, boolean client)
Constructor for theTransportSocketProcessor
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
process(Socket socket)
Used to connect theSocket
which is a full duplex TCP connection to a higher layer the application.void
stop()
This is implemented to shut down the server asynchronously.
-
-
-
Constructor Detail
-
TransportSocketProcessor
public TransportSocketProcessor(TransportProcessor processor) throws java.io.IOException
Constructor for theTransportSocketProcessor
object. The transport processor is used to process plain connections and wrap those connections in aTransport
that can be used to send and receive data to and from.- Parameters:
processor
- this is used to process transports- Throws:
java.io.IOException
-
TransportSocketProcessor
public TransportSocketProcessor(TransportProcessor processor, int threads) throws java.io.IOException
Constructor for theTransportSocketProcessor
object. The transport processor is used to process plain connections and wrap those connections in aTransport
that can be used to send and receive data to and from.- Parameters:
processor
- this is used to process transportsthreads
- this is the number of threads this will use- Throws:
java.io.IOException
-
TransportSocketProcessor
public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer) throws java.io.IOException
Constructor for theTransportSocketProcessor
object. The transport processor is used to process plain connections and wrap those connections in aTransport
that can be used to send and receive data to and from.- Parameters:
processor
- this is used to process transportsthreads
- this is the number of threads this will usebuffer
- this is the initial size of the output buffer- Throws:
java.io.IOException
-
TransportSocketProcessor
public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold) throws java.io.IOException
Constructor for theTransportSocketProcessor
object. The transport processor is used to process plain connections and wrap those connections in aTransport
that can be used to send and receive data to and from.- Parameters:
processor
- this is used to process transportsthreads
- this is the number of threads this will usebuffer
- this is the initial size of the output bufferthreshold
- this is the maximum size of the output buffer- Throws:
java.io.IOException
-
TransportSocketProcessor
public TransportSocketProcessor(TransportProcessor processor, int threads, int buffer, int threshold, boolean client) throws java.io.IOException
Constructor for theTransportSocketProcessor
object. The transport processor is used to process plain connections and wrap those connections in aTransport
that can be used to send and receive data to and from.- Parameters:
processor
- this is used to process transportsthreads
- this is the number of threads this will usebuffer
- this is the initial size of the output bufferthreshold
- this is the maximum size of the output bufferclient
- determines if the SSL handshake is for a client- Throws:
java.io.IOException
-
-
Method Detail
-
process
public void process(Socket socket) throws java.io.IOException
Used to connect theSocket
which is a full duplex TCP connection to a higher layer the application. It is this layer that is responsible for interpreting a protocol or handling messages in some manner. In the case of HTTP this will initiate the consumption of a HTTP request after any SSL handshake is finished if the connection is secure.- Specified by:
process
in interfaceSocketProcessor
- Parameters:
socket
- this is the connected HTTP pipeline to process- Throws:
java.io.IOException
-
stop
public void stop() throws java.io.IOException
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.- Specified by:
stop
in interfaceSocketProcessor
- Throws:
java.io.IOException
-
-