Class HttpSessionMutexListener
java.lang.Object
org.springframework.web.util.HttpSessionMutexListener
- All Implemented Interfaces:
jakarta.servlet.http.HttpSessionListener, EventListener
public class HttpSessionMutexListener
extends Object
implements jakarta.servlet.http.HttpSessionListener
Servlet 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.
- Since:
- 1.2.7
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsessionCreated(jakarta.servlet.http.HttpSessionEvent event) voidsessionDestroyed(jakarta.servlet.http.HttpSessionEvent event)
-
Constructor Details
-
HttpSessionMutexListener
public HttpSessionMutexListener()
-
-
Method Details
-
sessionCreated
public void sessionCreated(jakarta.servlet.http.HttpSessionEvent event) - Specified by:
sessionCreatedin interfacejakarta.servlet.http.HttpSessionListener
-
sessionDestroyed
public void sessionDestroyed(jakarta.servlet.http.HttpSessionEvent event) - Specified by:
sessionDestroyedin interfacejakarta.servlet.http.HttpSessionListener
-