/** * Ends this particular session. If it's a browsing session, the browsing generator is removed; * otherwise, the entire user's session can be removed. * * @param user user id * @param type type of session * @param key browsing session id (null if session type is EDIT) */ public void endSession(String user, int type, String key) { if (!userMap.containsKey(user)) return; if (type == LiberSession.BROWSE) { LiberSession session = userMap.get(user); synchronized (session) { session.removeBrowsingGenerator(key); } } else { if (type == LiberSession.QUERY) userMap.get(user).printQueryTimes(); userMap.remove(user); } Runtime r = Runtime.getRuntime(); r.gc(); // FORCES GARBAGE COLLECTION r.runFinalization(); }