Module datarush.commons
Interface GenericTCPServer.ConnectionHandler
-
- Enclosing class:
- GenericTCPServer
public static interface GenericTCPServer.ConnectionHandler
Handles incomming connections
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
Called upon server shutdown.void
handle(SocketChannel connection)
Handle the connection.void
init(GenericTCPServer.ServerContext context)
Called upon server start to inform the handler of context information such as the listening address.
-
-
-
Method Detail
-
handle
void handle(SocketChannel connection) throws Exception
Handle the connection. The caller handles closing the connection upon return from this method. Any errors thrown by this method will be logged by the caller. Note that this method will be called by multiple threads so implementations must be thread-safe.- Parameters:
connection
- the socket connection- Throws:
Exception
- if an unexpected error occurred
-
init
void init(GenericTCPServer.ServerContext context)
Called upon server start to inform the handler of context information such as the listening address. This method will be called prior to accepting any requests.- Parameters:
context
- the server context
-
destroy
void destroy()
Called upon server shutdown. This method will be called only after the last request has finished.
-
-