/** Starts us. */ public void start() throws PushletException { if (timer != null) { stop(); } timer = new Timer(false); timer.schedule(new AgingTimerTask(), TIMER_INTERVAL_MILLIS, TIMER_INTERVAL_MILLIS); info("started; interval=" + TIMER_INTERVAL_MILLIS + "ms"); }
/** Add session. */ public void addSession(Session session) { synchronized (mutex) { sessions.put(session.getId(), session); sessionCacheDirty = true; } // log(session.getId() + " at " + session.getAddress() + " adding "); info(session.getId() + " at " + session.getAddress() + " added "); }
/** Stopis us. */ public void stop() { if (timer != null) { timer.cancel(); timer = null; } synchronized (mutex) { sessions.clear(); } info("stopped"); }
/** Register session for removal. */ public Session removeSession(Session aSession) { synchronized (mutex) { Session session = (Session) sessions.remove(aSession.getId()); if (session != null) { info(session.getId() + " at " + session.getAddress() + " removed "); } sessionCacheDirty = true; return session; } }