public class InMemorySessionManager extends Object implements SessionManager, SessionManagerStatistics
ATTACHMENT_KEY
Constructor and Description |
---|
InMemorySessionManager(SessionIdGenerator sessionIdGenerator, String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax) |
InMemorySessionManager(SessionIdGenerator sessionIdGenerator, String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax, boolean statisticsEnabled) |
InMemorySessionManager(String id) |
InMemorySessionManager(String deploymentName, int maxSessions) |
InMemorySessionManager(String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax) |
Modifier and Type | Method and Description |
---|---|
Session | createSession(HttpServerExchange serverExchange, SessionConfig config) Creates a new session. |
boolean | equals(Object object) |
long | getActiveSessionCount() |
Set<String> | getActiveSessions() Returns the identifiers of those sessions that are active on this node, excluding passivated sessions |
Set<String> | getAllSessions() Returns the identifiers of all sessions, including both active and passive |
long | getAverageSessionAliveTime() |
long | getCreatedSessionCount() |
String | getDeploymentName() Uniquely identifies this session manager |
long | getExpiredSessionCount() |
long | getMaxActiveSessions() |
long | getMaxSessionAliveTime() |
long | getRejectedSessions() |
Session | getSession(HttpServerExchange serverExchange, SessionConfig config) |
Session | getSession(String sessionId) Retrieves a session with the given session id |
long | getStartTime() |
SessionManagerStatistics | getStatistics() Returns the statistics for this session manager, or null, if statistics are not supported. |
Set<String> | getTransientSessions() Returns the identifiers of those sessions that would be lost upon shutdown of this node |
int | hashCode() |
void | registerSessionListener(SessionListener listener) Registers a session listener for the session manager |
void | removeSessionListener(SessionListener listener) Removes a session listener from the session manager |
void | setDefaultSessionTimeout(int timeout) Sets the default session timeout |
void | start() Starts the session manager |
void | stop() stops the session manager |
String | toString() |
public InMemorySessionManager(String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax)
public InMemorySessionManager(SessionIdGenerator sessionIdGenerator, String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax)
public InMemorySessionManager(SessionIdGenerator sessionIdGenerator, String deploymentName, int maxSessions, boolean expireOldestUnusedSessionOnMax, boolean statisticsEnabled)
public InMemorySessionManager(String deploymentName, int maxSessions)
public InMemorySessionManager(String id)
public String getDeploymentName()
SessionManager
getDeploymentName
in interface SessionManager
public void start()
SessionManager
start
in interface SessionManager
public void stop()
SessionManager
stop
in interface SessionManager
public Session createSession(HttpServerExchange serverExchange, SessionConfig config)
SessionManager
SessionListener
s 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.
createSession
in interface SessionManager
public Session getSession(HttpServerExchange serverExchange, SessionConfig config)
getSession
in interface SessionManager
public Session getSession(String sessionId)
SessionManager
getSession
in interface SessionManager
sessionId
- The session IDpublic void registerSessionListener(SessionListener listener)
SessionManager
registerSessionListener
in interface SessionManager
listener
- The listenerpublic void removeSessionListener(SessionListener listener)
SessionManager
removeSessionListener
in interface SessionManager
listener
- the listenerpublic void setDefaultSessionTimeout(int timeout)
SessionManager
setDefaultSessionTimeout
in interface SessionManager
timeout
- the timeoutpublic Set<String> getTransientSessions()
SessionManager
getTransientSessions
in interface SessionManager
public Set<String> getActiveSessions()
SessionManager
getActiveSessions
in interface SessionManager
public Set<String> getAllSessions()
SessionManager
getAllSessions
in interface SessionManager
public SessionManagerStatistics getStatistics()
SessionManager
getStatistics
in interface SessionManager
public long getCreatedSessionCount()
getCreatedSessionCount
in interface SessionManagerStatistics
public long getMaxActiveSessions()
getMaxActiveSessions
in interface SessionManagerStatistics
public long getActiveSessionCount()
getActiveSessionCount
in interface SessionManagerStatistics
public long getExpiredSessionCount()
getExpiredSessionCount
in interface SessionManagerStatistics
public long getRejectedSessions()
getRejectedSessions
in interface SessionManagerStatistics
public long getMaxSessionAliveTime()
getMaxSessionAliveTime
in interface SessionManagerStatistics
public long getAverageSessionAliveTime()
getAverageSessionAliveTime
in interface SessionManagerStatistics
public long getStartTime()
getStartTime
in interface SessionManagerStatistics
Copyright © 2015 JBoss by Red Hat. All rights reserved.