Class HttpSessionMutexListener

  extended by org.springframework.web.util.HttpSessionMutexListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionListener

public class HttpSessionMutexListener
extends java.lang.Object
implements javax.servlet.http.HttpSessionListener

Servlet 2.3 HttpSessionListener that automatically exposes the session mutex when an HttpSession gets created. To be registered as a listener in 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.

Juergen Hoeller
See Also:
WebUtils.SESSION_MUTEX_ATTRIBUTE, WebUtils.getSessionMutex(javax.servlet.http.HttpSession), AbstractController.setSynchronizeOnSession(boolean)

Constructor Summary
Method Summary
 void sessionCreated(javax.servlet.http.HttpSessionEvent event)
 void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public HttpSessionMutexListener()
Method Detail


public void sessionCreated(javax.servlet.http.HttpSessionEvent event)
Specified by:
sessionCreated in interface javax.servlet.http.HttpSessionListener


public void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Specified by:
sessionDestroyed in interface javax.servlet.http.HttpSessionListener