Class Session

    • Method Detail

      • getId

        public java.lang.String getId()
      • getSessionScope

        protected SessionScope getSessionScope()
      • getAttribute

        public <T> T getAttribute​(java.lang.String name)
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
      • getAttributeNames

        public java.util.Collection<java.lang.String> getAttributeNames()
      • removeAttribute

        public void removeAttribute​(java.lang.String name)
      • getCreationTime

        public long getCreationTime()
      • getLastAccessedTime

        public long getLastAccessedTime()
      • getMaxInactiveInterval

        public int getMaxInactiveInterval()
      • setMaxInactiveInterval

        public void setMaxInactiveInterval​(int secs)
      • updateInactivityTimer

        public void updateInactivityTimer()
        Set the inactivity timer to the smaller of the session maxInactivity (ie session-timeout from web.xml), or the inactive eviction time.
      • stopInactivityTimer

        protected void stopInactivityTimer()
        Stop the session inactivity timer.
      • invalidate

        public void invalidate()
        Called by users to invalidate a session, or called by the access method as a request enters the session if the session has expired, or called by manager as a result of scavenger expiring session.
      • beginInvalidate

        protected boolean beginInvalidate()
      • finishInvalidate

        protected void finishInvalidate()
      • isNew

        public boolean isNew()
                      throws java.lang.IllegalStateException
        Throws:
        java.lang.IllegalStateException
      • isValid

        public boolean isValid()
      • isResident

        protected boolean isResident()
      • setResident

        protected void setResident​(boolean resident)
      • isExpiredAt

        protected boolean isExpiredAt​(long time)
        Check to see if session has expired as at the time given.
        Parameters:
        time - the time since the epoch in ms
        Returns:
        true if expired
      • isIdleLongerThan

        protected boolean isIdleLongerThan​(int sec)
        Check if the Session has been idle longer than a number of seconds.
        Parameters:
        sec - the number of seconds
        Returns:
        true if the session has been idle longer than the interval
      • checkValidForWrite

        protected void checkValidForWrite()
                                   throws java.lang.IllegalStateException
        Check that the session can be modified.
        Throws:
        java.lang.IllegalStateException - if the session is invalid
      • checkValidForRead

        protected void checkValidForRead()
                                  throws java.lang.IllegalStateException
        Check that the session data can be read.
        Throws:
        java.lang.IllegalStateException - if the session is invalid
      • checkLocked

        protected void checkLocked()
                            throws java.lang.IllegalStateException
        Throws:
        java.lang.IllegalStateException
      • lock

        public Locker.Lock lock()
        Grab the lock on the session.
        Returns:
        the lock
      • lockIfNotHeld

        public Locker.Lock lockIfNotHeld()
        Grab the lock on the session if it isn't locked already.
        Returns:
        the lock
      • access

        protected boolean access​(long time)
      • complete

        protected void complete()
      • getRequests

        public long getRequests()
        Returns the current number of requests that are active in the Session.
        Returns:
        the number of active requests for this session
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object