public interface SocketProcessor
SocketProcessor
interface represents a processor that
is used to accept Socket
objects. Implementations of
this object will typically hand the socket over for processing either
by some form of protocol handler or message processor. If the socket
contains an SSLEngine
an SSL hand shake may be performed
before any messages on the socket are interpreted.SocketConnection
Modifier and Type | Method and Description |
---|---|
void |
process(Socket socket)
Used to process the
Socket which is a full duplex
TCP connection to a higher layer the application. |
void |
stop()
This method is used to stop the
SocketProcessor such
that it will accept no more sockets. |
void process(Socket socket) throws IOException
Socket
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.socket
- this is the connected HTTP socket to processIOException
void stop() throws IOException
SocketProcessor
such
that it will accept no more sockets. Stopping the server 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.
IOException
Copyright © 2019. All rights reserved.