Class DefaultSessionCache

    • Constructor Detail

      • DefaultSessionCache

        public DefaultSessionCache​(SessionHandler sessionHandler,
                                   SessionStore sessionStore,
                                   boolean clusterEnabled)
    • Method Detail

      • getMaxSessions

        public int getMaxSessions()
      • setMaxSessions

        public void setMaxSessions​(int maxSessions)
        Description copied from interface: SessionCache
        Sets the maximum number of active sessions allowed in this session cache. The number of active sessions exceeds this limit, attempts to create new sessions will be rejected. If set to 0 (the default), there is no limit.
        Parameters:
        maxSessions - the maximum number of active sessions allowed in this session cache
      • doPutIfAbsent

        protected DefaultSession doPutIfAbsent​(java.lang.String id,
                                               DefaultSession session)
        Description copied from class: AbstractSessionCache
        Put the session into the map if it wasn't already there.
        Specified by:
        doPutIfAbsent in class AbstractSessionCache
        Parameters:
        id - the identity of the session
        session - the session object
        Returns:
        null if the session wasn't already in the map, or the existing entry otherwise
      • doComputeIfAbsent

        protected DefaultSession doComputeIfAbsent​(java.lang.String id,
                                                   java.util.function.Function<java.lang.String,​DefaultSession> mappingFunction)
        Description copied from class: AbstractSessionCache
        Compute the mappingFunction to create a Session object if the session with the given id isn't already in the map, otherwise return the existing Session. This method is expected to have precisely the same behaviour as ConcurrentHashMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>)
        Specified by:
        doComputeIfAbsent in class AbstractSessionCache
        Parameters:
        id - the session id
        mappingFunction - the function to load the data for the session
        Returns:
        an existing Session from the cache
      • doReplace

        protected boolean doReplace​(java.lang.String id,
                                    DefaultSession oldValue,
                                    DefaultSession newValue)
        Description copied from class: AbstractSessionCache
        Replace the mapping from id to oldValue with newValue.
        Specified by:
        doReplace in class AbstractSessionCache
        Parameters:
        id - the session id
        oldValue - the old value
        newValue - the new value
        Returns:
        true if replacement was done
      • getAllSessions

        public java.util.Set<java.lang.String> getAllSessions()
      • getActiveSessionCount

        public long getActiveSessionCount()
        Returns:
        the number of sessions in the cache
      • getHighestSessionCount

        public long getHighestSessionCount()
        Returns:
        the max number of sessions in the cache
      • getCreatedSessionCount

        public long getCreatedSessionCount()
        Returns:
        a running total of sessions in the cache
      • getExpiredSessionCount

        public long getExpiredSessionCount()
      • getRejectedSessionCount

        public long getRejectedSessionCount()
      • resetStatistics

        public void resetStatistics()
        Description copied from interface: SessionCache
        Resets the running total session count in the cache.
      • doInitialize

        protected void doInitialize()
                             throws java.lang.Exception
        Specified by:
        doInitialize in class AbstractComponent
        Throws:
        java.lang.Exception
      • doDestroy

        protected void doDestroy()
                          throws java.lang.Exception
        Specified by:
        doDestroy in class AbstractComponent
        Throws:
        java.lang.Exception