@Override public final void removeSession(final AbstractSession session, boolean invalidate) { final String clusterId = getClusterId(session); final boolean removed = removeSession(clusterId); if (removed) { _sessionsStats.decrement(); _sessionTimeStats.set(Math.round((System.currentTimeMillis() - session.getCreationTime()) / 1000.0)); _sessionIdManager.removeSession(session); if (invalidate) { _sessionIdManager.invalidateAll(session.getClusterId()); } if (invalidate && _sessionListeners != null) { final HttpSessionEvent event = new HttpSessionEvent(session); for (int i = LazyList.size(_sessionListeners); i-- > 0;) { ((HttpSessionListener) LazyList.get(_sessionListeners, i)).sessionDestroyed(event); } } if (!invalidate) { session.willPassivate(); } } }
private void addListenersIfItIsFirstRequest(Session session){ if(firstRequest){ for(EventListener l: listeners){ ((AbstractSession)session.raw()).getSessionManager().addEventListener(l); } } firstRequest = false; }
@Override protected final void addSession(final AbstractSession session) { if (isRunning()) { final String clusterId = getClusterId(session); sessions.put(clusterId, (Session) session); session.willPassivate(); storeSession((Session) session); session.didActivate(); } }
/** * Call any session id listeners registered. * Usually done by renewSessionId() method, but that is not used in appengine. * @param session * @param oldId */ public void callSessionIdListeners (AbstractSession session, String oldId) { HttpSessionEvent event = new HttpSessionEvent(session); for (HttpSessionIdListener l:_sessionIdListeners) { l.sessionIdChanged(event, oldId); } }
public final void invalidateSession(final String clusterId) { final AbstractSession session = sessions.get(clusterId); if (session != null) { session.invalidate(); } }
@Override protected AbstractSession newSession(HttpServletRequest request) { return new RedisNoSqlSession(this, request); }
@Override protected void addSession(AbstractSession session) { // No list of sessions is kept in memory, so do nothing here. }