public class SessionMonitor
extends java.lang.Object
implements javax.servlet.http.HttpSessionListener
Modifier and Type | Field and Description |
---|---|
protected java.util.List<javax.servlet.http.HttpSessionListener> |
listeners |
protected java.util.concurrent.ConcurrentMap<java.lang.String,javax.servlet.http.HttpSession> |
sessionMap |
protected static SessionMonitor |
sessionMonitor |
Constructor and Description |
---|
SessionMonitor()
Creates new session monitor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this session monitor by removing all collected resources.
|
static SessionMonitor |
getInstance()
Returns singleton instance of
SessionMonitor . |
javax.servlet.http.HttpSession |
getSession(java.lang.String sessionId)
Returns session for given session id.
|
java.util.Iterator<java.lang.String> |
iterator()
Returns iterator for all stored session IDs.
|
void |
registerListener(javax.servlet.http.HttpSessionListener listener)
Registers new session listener.
|
void |
removeListener(javax.servlet.http.HttpSessionListener listener)
Removes existing session listener.
|
void |
sessionCreated(javax.servlet.http.HttpSessionEvent httpSessionEvent)
Stores session in map and broadcasts event to registered listeners.
|
void |
sessionDestroyed(javax.servlet.http.HttpSessionEvent httpSessionEvent)
Removes session from a map and broadcasts event to registered listeners.
|
protected static SessionMonitor sessionMonitor
protected java.util.List<javax.servlet.http.HttpSessionListener> listeners
protected java.util.concurrent.ConcurrentMap<java.lang.String,javax.servlet.http.HttpSession> sessionMap
public static SessionMonitor getInstance()
SessionMonitor
.public void registerListener(javax.servlet.http.HttpSessionListener listener)
public void removeListener(javax.servlet.http.HttpSessionListener listener)
public void sessionCreated(javax.servlet.http.HttpSessionEvent httpSessionEvent)
sessionCreated
in interface javax.servlet.http.HttpSessionListener
public void sessionDestroyed(javax.servlet.http.HttpSessionEvent httpSessionEvent)
sessionDestroyed
in interface javax.servlet.http.HttpSessionListener
public javax.servlet.http.HttpSession getSession(java.lang.String sessionId)
null
if session expired.public java.util.Iterator<java.lang.String> iterator()
public void destroy()
Copyright © 2003-present Jodd Team