Interface SessionHandler

    • Method Detail

      • getWorkerName

        java.lang.String getWorkerName()
      • getDefaultMaxIdleSecs

        int getDefaultMaxIdleSecs()
      • setDefaultMaxIdleSecs

        void setDefaultMaxIdleSecs​(int defaultMaxIdleSecs)
      • getSession

        DefaultSession getSession​(java.lang.String id)
        Get a known existing session.
        Parameters:
        id - the session id
        Returns:
        a Session or null if none exists
      • createSession

        DefaultSession createSession​(java.lang.String id)
        Create an entirely new Session.
        Parameters:
        id - identity of session to create
        Returns:
        the new session object
      • createSessionId

        java.lang.String createSessionId​(long seedTerm)
        Create a new Session ID.
        Parameters:
        seedTerm - the seed for RNG
        Returns:
        the new session id
      • renewSessionId

        java.lang.String renewSessionId​(java.lang.String oldId,
                                        java.lang.String newId)
        Change the id of a Session.
        Parameters:
        oldId - the current session id
        newId - the new session id
        Returns:
        the Session after changing its id
      • removeSession

        DefaultSession removeSession​(java.lang.String id,
                                     boolean invalidate)
        Remove session from manager.
        Parameters:
        id - the session to remove
        invalidate - if false, only remove from cache
        Returns:
        if the session was removed
      • invalidate

        void invalidate​(java.lang.String id)
        Called when a session has expired.
        Parameters:
        id - the id to invalidate
      • sessionInactivityTimerExpired

        void sessionInactivityTimerExpired​(DefaultSession session,
                                           long now)
        Each session has a timer that is configured to go off when either the session has not been accessed for a configurable amount of time, or the session itself has passed its expiry. If it has passed its expiry, then we will mark it for scavenging by next run of the HouseKeeper; if it has been idle longer than the configured eviction period, we evict from the cache. If none of the above are true, then the System timer is inconsistent and the caller of this method will need to reset the timer.
        Parameters:
        session - the default session
        now - the time at which to check for expiry
      • scavenge

        void scavenge()
        Called periodically by the HouseKeeper to handle the list of sessions that have expired since the last call to scavenge.
      • fireSessionAttributeListeners

        void fireSessionAttributeListeners​(Session session,
                                           java.lang.String name,
                                           java.lang.Object oldValue,
                                           java.lang.Object newValue)
        Call binding and attribute listeners based on the new and old values of the attribute.
        Parameters:
        name - name of the attribute
        newValue - new value of the attribute
        oldValue - previous value of the attribute
        Throws:
        java.lang.IllegalStateException - if no session manager can be find
      • fireSessionDestroyedListeners

        void fireSessionDestroyedListeners​(Session session)
        Call the session lifecycle listeners.
        Parameters:
        session - the session on which to call the lifecycle listeners
      • recordSessionTime

        void recordSessionTime​(DefaultSession session)
        Record length of time session has been active. Called when the session is about to be invalidated.
        Parameters:
        session - the session whose time to record
      • getSessionTimeMax

        long getSessionTimeMax()
        Returns:
        the maximum amount of time session remained valid
      • getSessionTimeTotal

        long getSessionTimeTotal()
        Returns:
        the total amount of time all sessions remained valid
      • getSessionTimeMean

        long getSessionTimeMean()
        Returns:
        the mean amount of time session remained valid
      • getSessionTimeStdDev

        double getSessionTimeStdDev()
        Returns:
        the standard deviation of amount of time session remained valid
      • statsReset

        void statsReset()
        Resets the session usage statistics.