Class InMemorySessionManager

    • Constructor Detail

      • InMemorySessionManager

        public InMemorySessionManager​(java.lang.String deploymentName,
                                      int maxSessions,
                                      boolean expireOldestUnusedSessionOnMax)
      • InMemorySessionManager

        public InMemorySessionManager​(SessionIdGenerator sessionIdGenerator,
                                      java.lang.String deploymentName,
                                      int maxSessions,
                                      boolean expireOldestUnusedSessionOnMax)
      • InMemorySessionManager

        public InMemorySessionManager​(SessionIdGenerator sessionIdGenerator,
                                      java.lang.String deploymentName,
                                      int maxSessions,
                                      boolean expireOldestUnusedSessionOnMax,
                                      boolean statisticsEnabled)
      • InMemorySessionManager

        public InMemorySessionManager​(java.lang.String deploymentName,
                                      int maxSessions)
      • InMemorySessionManager

        public InMemorySessionManager​(java.lang.String id)
    • Method Detail

      • getDeploymentName

        public java.lang.String getDeploymentName()
        Description copied from interface: SessionManager
        Uniquely identifies this session manager
        Specified by:
        getDeploymentName in interface SessionManager
        Returns:
        a unique identifier
      • createSession

        public Session createSession​(HttpServerExchange serverExchange,
                                     SessionConfig config)
        Description copied from interface: SessionManager
        Creates a new session. Any SessionListeners registered with this manager will be notified of the session creation.

        This method *MUST* call SessionConfig.findSessionId(io.undertow.server.HttpServerExchange) (io.undertow.server.HttpServerExchange)} first to determine if an existing session ID is present in the exchange. If this id is present then it must be used as the new session ID. If a session with this ID already exists then an IllegalStateException must be thrown.

        This requirement exists to allow forwards across servlet contexts to work correctly. The session manager is responsible for making sure that a newly created session is accessible to later calls to SessionManager.getSession(io.undertow.server.HttpServerExchange, SessionConfig) from the same request. It is recommended that a non static attachment key be used to store the newly created session as an attachment. The attachment key must be static to prevent different session managers from interfering with each other.

        Specified by:
        createSession in interface SessionManager
        Returns:
        The created session
      • getSession

        public Session getSession​(java.lang.String sessionId)
        Description copied from interface: SessionManager
        Retrieves a session with the given session id
        Specified by:
        getSession in interface SessionManager
        Parameters:
        sessionId - The session ID
        Returns:
        The session, or null if it does not exist
      • setDefaultSessionTimeout

        public void setDefaultSessionTimeout​(int timeout)
        Description copied from interface: SessionManager
        Sets the default session timeout
        Specified by:
        setDefaultSessionTimeout in interface SessionManager
        Parameters:
        timeout - the timeout
      • getTransientSessions

        public java.util.Set<java.lang.String> getTransientSessions()
        Description copied from interface: SessionManager
        Returns the identifiers of those sessions that would be lost upon shutdown of this node
        Specified by:
        getTransientSessions in interface SessionManager
      • getActiveSessions

        public java.util.Set<java.lang.String> getActiveSessions()
        Description copied from interface: SessionManager
        Returns the identifiers of those sessions that are active on this node, excluding passivated sessions
        Specified by:
        getActiveSessions in interface SessionManager
      • getAllSessions

        public java.util.Set<java.lang.String> getAllSessions()
        Description copied from interface: SessionManager
        Returns the identifiers of all sessions, including both active and passive
        Specified by:
        getAllSessions in interface SessionManager
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public long getHighestSessionCount()