1 // $Id: IDisconnectHandler.java 1324 2007-06-13 06:06:02Z grro $ 2 /* 3 * Copyright (c) xsocket.org, 2006 - 2007. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt 20 * The latest copy of this software may be found on http://www.xsocket.org/ 21 */ 22 23 package org.xsocket.stream; 24 25 import java.io.IOException; 26 27 28 29 30 31 /** 32 * Handles the disconnecting of connections. <br> 33 * The disconnecting of a connection occurs in three ways: 34 * <ul> 35 * <li> the client initiates the disconnect by closing the connection. In this case the 36 * <code>onDisconnect</code> method will be called immediately 37 * <li> the connection breaks or the client disconnects improperly and the underlying SocketChannel 38 * detects the broken connection. In this case the <code>onDisconnect</code> method will be 39 * called, when 40 * the broken conection will be detected 41 * <li> the connection breaks or the client disconnects improperly and the underlying SocketChannel 42 * doesn't detect the broken connection. In this case the <code>onDisconnect</code> method 43 * will only be called after a connection or idle timeout (see {@link ITimeoutHandler}) 44 * </ul> 45 * 46 * 47 * @author grro@xsocket.org 48 */ 49 public interface IDisconnectHandler extends IHandler { 50 51 52 /** 53 * handles disconnecting of a connection 54 * 55 * 56 * @param connection the <i>closed</i> connection 57 * @return true for positive result of handling, false for negative result of handling 58 * @throws IOException If some I/O error occurs. 59 */ 60 public boolean onDisconnect(INonBlockingConnection connection) throws IOException; 61 62 } 63