protected void flushSessions ( ) { List < PresentsSession > victims = Lists . newArrayList ( ) ; long now = System . currentTimeMillis ( ) ; // first build a list of our victims synchronized ( _usermap ) { for ( PresentsSession session : _usermap . values ( ) ) { if ( session . checkExpired ( now ) ) { victims . add ( session ) ; } } } // now end their sessions for ( PresentsSession session : victims ) { try { log . info ( "Session expired, ending session" , "session" , session , "dtime" , ( now - session . getNetworkStamp ( ) ) + "ms]." ) ; session . endSession ( ) ; } catch ( Exception e ) { log . warning ( "Choke while flushing session" , "victim" , session , e ) ; } } }
Called once per minute to check for sessions that have been disconnected too long and forcibly end their sessions .