/** * Returns all active sessions in the system. * <p/> * <p>This implementation merely returns the sessions found in the activeSessions cache. Subclass implementations * may wish to override this method to retrieve them in a different way, perhaps by an RDBMS query or by other * means. * * @return the sessions found in the activeSessions cache. */ public Collection<Session> getActiveSessions() { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { return cache.values(); } else { return Collections.emptySet(); } } }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Returns the cached session with the corresponding {@code sessionId} or {@code null} if there is * no session cached under that id (or if there is no Cache). * * @param sessionId the id of the cached session to acquire. * @return the cached session with the corresponding {@code sessionId}, or {@code null} if the session * does not exist or is not cached. */ protected Session getCachedSession(Serializable sessionId) { Session cached = null; if (sessionId != null) { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cached = getCachedSession(sessionId, cache); } } return cached; }
/** * Removes the specified Session from the cache. * * @param session the session to remove from the cache. */ protected void uncache(Session session) { if (session == null) { return; } Serializable id = session.getId(); if (id == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cache.remove(id); } }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Returns the cached session with the corresponding {@code sessionId} or {@code null} if there is * no session cached under that id (or if there is no Cache). * * @param sessionId the id of the cached session to acquire. * @return the cached session with the corresponding {@code sessionId}, or {@code null} if the session * does not exist or is not cached. */ protected Session getCachedSession(Serializable sessionId) { Session cached = null; if (sessionId != null) { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cached = getCachedSession(sessionId, cache); } } return cached; }
/** * Returns all active sessions in the system. * <p/> * <p>This implementation merely returns the sessions found in the activeSessions cache. Subclass implementations * may wish to override this method to retrieve them in a different way, perhaps by an RDBMS query or by other * means. * * @return the sessions found in the activeSessions cache. */ public Collection<Session> getActiveSessions() { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { return cache.values(); } else { return Collections.emptySet(); } } }
/** * Removes the specified Session from the cache. * * @param session the session to remove from the cache. */ protected void uncache(Session session) { if (session == null) { return; } Serializable id = session.getId(); if (id == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cache.remove(id); } }
/** * Returns all active sessions in the system. * <p/> * <p>This implementation merely returns the sessions found in the activeSessions cache. Subclass implementations * may wish to override this method to retrieve them in a different way, perhaps by an RDBMS query or by other * means. * * @return the sessions found in the activeSessions cache. */ public Collection<Session> getActiveSessions() { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { return cache.values(); } else { return Collections.emptySet(); } } }
/** * Caches the specified session under the cache entry key of {@code sessionId}. * * @param session the session to cache * @param sessionId the session id, to be used as the cache entry key. * @since 1.0 */ protected void cache(Session session, Serializable sessionId) { if (session == null || sessionId == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache == null) { return; } cache(session, sessionId, cache); }
/** * Returns the cached session with the corresponding {@code sessionId} or {@code null} if there is * no session cached under that id (or if there is no Cache). * * @param sessionId the id of the cached session to acquire. * @return the cached session with the corresponding {@code sessionId}, or {@code null} if the session * does not exist or is not cached. */ protected Session getCachedSession(Serializable sessionId) { Session cached = null; if (sessionId != null) { Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cached = getCachedSession(sessionId, cache); } } return cached; }
/** * Removes the specified Session from the cache. * * @param session the session to remove from the cache. */ protected void uncache(Session session) { if (session == null) { return; } Serializable id = session.getId(); if (id == null) { return; } Cache<Serializable, Session> cache = getActiveSessionsCacheLazy(); if (cache != null) { cache.remove(id); } }