Class SessionCache

    • Constructor Detail

      • SessionCache

        public SessionCache()
    • Method Detail

      • setCacheManager

        public void setCacheManager​(net.sf.ehcache.CacheManager manager)
        Injection method, also performs the creation of sessions
      • setUpdateInterval

        public void setUpdateInterval​(long milliseconds)
        Inject time in milliseconds between updates.
      • addSessionCallback

        public boolean addSessionCallback​(java.lang.String session,
                                          SessionCallback cb)
      • removeSessionCallback

        public boolean removeSessionCallback​(java.lang.String session,
                                             SessionCallback cb)
      • putSession

        public void putSession​(java.lang.String uuid,
                               SessionContext sessionContext)
        Puts a session blindly into the context. This does nothing to a context which was previously present (e.g. call internalRemove, etc.) and therefore usage should be proceeded by a check.
      • refresh

        public void refresh​(java.lang.String uuid,
                            SessionContext replacement)
        Used externally to refresh the SessionContext instance associated with the session uuid
        Parameters:
        uuid -
        replacement -
      • getSessionContext

        public SessionContext getSessionContext​(java.lang.String uuid)
        Retrieve a session possibly raising either RemovedSessionException or SessionTimeoutException.
      • getSessionContext

        public SessionContext getSessionContext​(java.lang.String uuid,
                                                boolean quietly)
        Retrieve a session possibly raising either RemovedSessionException or SessionTimeoutException.
        Parameters:
        quietly - If true, then the access time for the given UUID will not be updated.
      • getSessionData

        public java.util.Map<java.lang.String,​java.lang.Object> getSessionData​(java.lang.String uuid,
                                                                                     boolean quietly)
        Returns all the data contained in the internal implementation of this manager.
        Parameters:
        quietly - If true, then the access time for the given UUID will not be updated.
      • removeSession

        public void removeSession​(java.lang.String uuid)
      • getIds

        public java.util.Set<java.lang.String> getIds()
        Since all methods which use getIds() will subsequently check for the existing session, we do not block here. Blocking is primarily useful for post-admintype changes which can add or remove a user from a group. The existence of a session (which is what getIds specifies) is not significantly effected.
      • createCache

        protected net.sf.ehcache.Ehcache createCache​(java.lang.String key,
                                                     boolean inMemory,
                                                     int maxInMemory)
      • getLastUpdated

        public long getLastUpdated()
      • updateEvent

        public void updateEvent​(UserGroupUpdateEvent ugue)
        Adds a new entry to state. If the timestamp on the event is invalid, then System.currentTimeMillis() will be used.
      • doUpdate

        public void doUpdate()
        Will only ever be accessed by a single thread. Rechecks the target update time again in case a second write thread was blocking the current one. active gets set to true value to specify that this method is currently running.