Class AbstractSessionStore

    • Constructor Detail

      • AbstractSessionStore

        public AbstractSessionStore()
    • Method Detail

      • getGracePeriodSecs

        public int getGracePeriodSecs()
      • setGracePeriodSecs

        public void setGracePeriodSecs​(int gracePeriodSecs)
        Sets the interval in secs to prevent too eager session scavenging.
        Parameters:
        gracePeriodSecs - interval in secs to prevent too eager session scavenging
      • getSavePeriodSecs

        public int getSavePeriodSecs()
      • setSavePeriodSecs

        public void setSavePeriodSecs​(int savePeriodSecs)
        The minimum time in seconds between save operations. Saves normally occur every time the last request exits as session. If nothing changes on the session except for the access time and the persistence technology is slow, this can cause delays.

        By default the value is 0, which means we save after the last request exists. A non zero value means that we will skip doing the save if the session isn't dirty if the elapsed time since the session was last saved does not exceed this value.

        Parameters:
        savePeriodSecs - the savePeriodSecs to set
      • getNonPersistentAttributes

        public java.util.Set<java.lang.String> getNonPersistentAttributes()
        Description copied from interface: SessionStore
        Returns the names of the attributes that should be excluded from serialization.
        Specified by:
        getNonPersistentAttributes in interface SessionStore
        Returns:
        the attribute names to be excluded from serialization
      • setNonPersistentAttributes

        public void setNonPersistentAttributes​(java.lang.String... nonPersistentAttributes)
        Specifies attributes that should be excluded from serialization.
        Parameters:
        nonPersistentAttributes - the attribute names to exclude from serialization
      • isNonPersistentAttributes

        public boolean isNonPersistentAttributes​(java.lang.String attrName)
      • save

        public void save​(java.lang.String id,
                         SessionData data)
                  throws java.lang.Exception
        Description copied from interface: SessionStore
        Save the session data.
        Specified by:
        save in interface SessionStore
        Parameters:
        id - identity of session to store
        data - info of session to store
        Throws:
        java.lang.Exception - if unable to write session data
      • doSave

        public abstract void doSave​(java.lang.String id,
                                    SessionData data,
                                    long lastSaveTime)
                             throws java.lang.Exception
        Store the session data persistently.
        Parameters:
        id - identity of session to store
        data - info of the session
        lastSaveTime - time of previous save or 0 if never saved
        Throws:
        java.lang.Exception - if unable to store data
      • getExpired

        public java.util.Set<java.lang.String> getExpired​(java.util.Set<java.lang.String> candidates)
        Description copied from interface: SessionStore
        Called periodically, this method should search the data store for sessions that have been expired for a 'reasonable' amount of time.
        Specified by:
        getExpired in interface SessionStore
        Parameters:
        candidates - if provided, these are keys of sessions that the SessionStore thinks has expired and should be verified by the SessionStore
        Returns:
        set of session ids
      • doGetExpired

        public abstract java.util.Set<java.lang.String> doGetExpired​(java.util.Set<java.lang.String> candidates)
        Implemented by subclasses to resolve which sessions this node should attempt to expire.
        Parameters:
        candidates - the ids of sessions the SessionStore thinks has expired
        Returns:
        the reconciled set of session ids that this node should attempt to expire
      • getLastExpiryCheckTime

        public long getLastExpiryCheckTime()
      • checkAlreadyInitialized

        protected void checkAlreadyInitialized()
                                        throws java.lang.IllegalStateException
        Throws:
        java.lang.IllegalStateException