|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SocketHandler
Implemented by objects that handle individual connections accepted by a SocketAcceptor.
| Method Summary | |
|---|---|
void |
handleConnection(Socket socket)
Handle the connection. |
void |
stop(Thread thread,
Socket socket)
Receive notification that the server is shutting down. |
| Method Detail |
|---|
void handleConnection(Socket socket)
throws IOException
socket - connection socket
IOException - if needed
void stop(Thread thread,
Socket socket)
handleConnection()
returns as soon as possible.
After this method returns, the socket will be closed (if not already). So one way to implement this method
is to simply do nothing, which will trigger an IOException on the next access from within
handleConnection().
Alternately, set some flag that handleConnection() detects each time around its processing loop,
or use Thread.interrupt(), etc.
In any case, it is important that handleConnection() thread does eventually return,
otherwise the thread invoking SocketAcceptor.stop() will hang.
Note: it may be that handleConnection() has already returned when this method is invoked,
in which case this method should do nothing.
thread - the thread invoking handleConnection()socket - connection socket
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||