public int removeCallback ( IConnectionStateCallback criteria ) { List < IConnectionStateCallback > listCallbacks = getConnectionDetail ( ) . getConnCallbacks ( ) ; /** * If this method is about to delete the last callback, then * there are no windows left listening, so it is safe to * do a hard disconnect. */ if ( listCallbacks . size ( ) <= 1 ) { getConnectionDetail ( ) . unHappyDisconnect ( ) ; listCallbacks . remove ( criteria ) ; DefaultConnectionList connList = ( DefaultConnectionList ) DefaultConnectionList . getSingleton ( ) ; connList . remove ( this ) ; } else { //utter a last dying gasp (DISCONNECTED status) before removing the callback. //criteria.setConnectionState(ConnectState.DISCONNECTED); //broadcastConnectionState(criteria); listCallbacks . remove ( criteria ) ; } return listCallbacks . size ( ) ; }
Returns the count of callbacks still listening to this . This method will perform a hard disconnect if 0 is returned .