boolean connectionStateChanged ( int newState ) { switch ( newState ) { case ConnectionManager . CONNECTED : LOG . info ( listeningPort + ": Switched to CONNECTED state." ) ; // Try to resubscribe all the watched events try { return resubscribe ( ) ; } catch ( Exception e ) { LOG . error ( listeningPort + ": Resubscribing failed" , e ) ; return false ; } case ConnectionManager . DISCONNECTED_VISIBLE : LOG . info ( listeningPort + ": Switched to DISCONNECTED_VISIBLE state" ) ; for ( NamespaceEventKey eventKey : watchedEvents . keySet ( ) ) watchedEvents . put ( eventKey , - 1L ) ; watcher . connectionFailed ( ) ; break ; case ConnectionManager . DISCONNECTED_HIDDEN : LOG . info ( listeningPort + ": Switched to DISCONNECTED_HIDDEN state." ) ; } return true ; }
Called by the ConnectionManager when the connection state changed . The connection lock is hold when calling this method so no other methods from the ConnectionManager should be called here .