public void closeSession ( long index , long timestamp , RaftSession session , boolean expired ) { log . debug ( "Closing session {}" , session . sessionId ( ) ) ; // Update the session's timestamp to prevent it from being expired. session . setLastUpdated ( timestamp ) ; // Update the state machine index/timestamp. tick ( index , timestamp ) ; // Expire sessions that have timed out. expireSessions ( currentTimestamp ) ; // Remove the session from the sessions list. if ( expired ) { session = sessions . removeSession ( session . sessionId ( ) ) ; if ( session != null ) { session . expire ( ) ; service . expire ( session . sessionId ( ) ) ; } } else { session = sessions . removeSession ( session . sessionId ( ) ) ; if ( session != null ) { session . close ( ) ; service . close ( session . sessionId ( ) ) ; } } // Commit the index, causing events to be sent to clients if necessary. commit ( ) ; }
Unregister the given session .