public class HttpSessionMutexListener extends Object implements HttpSessionListener
web.xml
.
The session mutex is guaranteed to be the same object during
the entire lifetime of the session, available under the key defined
by the SESSION_MUTEX_ATTRIBUTE
constant. It serves as a
safe reference to synchronize on for locking on the current session.
In many cases, the HttpSession reference itself is a safe mutex as well, since it will always be the same object reference for the same active logical session. However, this is not guaranteed across different servlet containers; the only 100% safe way is a session mutex.
WebUtils.SESSION_MUTEX_ATTRIBUTE
,
WebUtils.getSessionMutex(javax.servlet.http.HttpSession)
,
AbstractController.setSynchronizeOnSession(boolean)
Constructor and Description |
---|
HttpSessionMutexListener() |
Modifier and Type | Method and Description |
---|---|
void |
sessionCreated(HttpSessionEvent event)
Receives notification that a session has been created.
|
void |
sessionDestroyed(HttpSessionEvent event)
Receives notification that a session is about to be invalidated.
|
public void sessionCreated(HttpSessionEvent event)
javax.servlet.http.HttpSessionListener
sessionCreated
in interface HttpSessionListener
event
- the HttpSessionEvent containing the sessionpublic void sessionDestroyed(HttpSessionEvent event)
javax.servlet.http.HttpSessionListener
sessionDestroyed
in interface HttpSessionListener
event
- the HttpSessionEvent containing the session