org.xsocket.connection
Interface IIdleTimeoutHandler

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

public interface IIdleTimeoutHandler
extends IHandler

Handles idle 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.setIdleTimeoutMillis(60 * 1000);
    ConnectionUtils.start(server);
    ...
    
    
    class MyHandler implements IIdleTimeoutHandler {
        
        public boolean onIdleTimeout(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 onIdleTimeout(INonBlockingConnection connection)
          handles the idle timeout.
 

Method Detail

onIdleTimeout

boolean onIdleTimeout(INonBlockingConnection connection)
                      throws IOException
handles the idle 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 2010 xSocket.org