org.xsocket.connection
Interface IConnectionTimeoutHandler

Package class diagram package IConnectionTimeoutHandler
All Superinterfaces:
IHandler
All Known Implementing Classes:
HandlerChain

public interface IConnectionTimeoutHandler
extends IHandler

Handles connection timeout. The timeouts will be defined by the server. To modify the timeouts the proper server methods has to be called. E.g.

    ...
    IServer server = new Server(new MyHandler());
    server.setConnectionTimeoutMillis(60 * 1000);
    ConnectionUtils.start(server);
    ...
    
    
    class MyHandler implements IConnectionTimeoutHandler {
    
        public boolean onConnectionTimeout(INonBlockingConnection connection) throws IOException {
           ...
           connection.close();
           return true; // true -> event has been handled (by returning false xSocket will close the connection)
        }
    }
 

Author:
grro@xsocket.org

Field Summary
 
Fields inherited from interface org.xsocket.connection.IHandler
DEFAULT_EXECUTION_MODE
 
Method Summary
 boolean onConnectionTimeout(INonBlockingConnection connection)
          handles the connection timeout.
 

Method Detail

onConnectionTimeout

boolean onConnectionTimeout(INonBlockingConnection connection)
                            throws IOException
handles the connection timeout.

Parameters:
connection - the underlying connection
Returns:
true if the timeout event has been handled (in case of false the connection will be closed by the server)
Throws:
IOException - if an error occurs. Throwing this exception causes that the underlying connection will be closed.


Copyright 2008 xSocket.org