public Listener < Session . State > onStateChange ( Consumer < Session . State > callback ) { Listener < Session . State > listener = new Listener < Session . State > ( ) { @ Override public void accept ( Session . State state ) { callback . accept ( state ) ; } @ Override public void close ( ) { changeListeners . remove ( this ) ; } } ; changeListeners . add ( listener ) ; return listener ; }
Registers a state change listener on the session manager .