/** * Garbage-collects any expired sessions. Must be called before client-inteface functions do * anything which relies on the existence a session, that is: creating sessions, using sessions or * checking whether sessions exist. * * <p>FIXME: Before putting the session manager into fred, write a thread which periodically * garbage collects old sessions - currently, sessions will only be garbage collected if any * client continues using the SessiomManager * * @param time The current time. */ private synchronized void removeExpiredSessions(long time) { for (Session session = mSessionsByID.peekValue(); session != null && session.isExpired(time); session = mSessionsByID.peekValue()) { mSessionsByID.popValue(); mSessionsByUserID.remove(session.getUserID()); } // FIXME: Execute every few hours only. verifyQueueOrder(); verifySessionsByUserIDTable(); }