Package com.oorian
Class OorianSessionMonitor
java.lang.Object
com.oorian.OorianSessionMonitor
- All Implemented Interfaces:
jakarta.servlet.http.HttpSessionListener,EventListener
@WebListener
public class OorianSessionMonitor
extends Object
implements jakarta.servlet.http.HttpSessionListener
Servlet listener that monitors HTTP session lifecycle events.
OorianSessionMonitor is automatically registered via the @WebListener
annotation and receives notifications for all session creation and destruction
events in the web application. It delegates these events to registered
OorianSessionListener implementations.
Key Responsibilities:
- Manages a list of application-specific session listeners
- Notifies listeners when sessions are created
- Triggers Oorian session cleanup when sessions are destroyed
- Notifies listeners when sessions are destroyed
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(OorianSessionListener listener) Registers a session listener to receive session lifecycle events.static voidRemoves all registered session listeners.static booleanremoveListener(OorianSessionListener listener) Removes a previously registered session listener.voidsessionCreated(jakarta.servlet.http.HttpSessionEvent se) Called by the container when a new session is created.voidsessionDestroyed(jakarta.servlet.http.HttpSessionEvent se) Called by the container when a session is about to be invalidated.
-
Constructor Details
-
OorianSessionMonitor
public OorianSessionMonitor()
-
-
Method Details
-
addListener
Registers a session listener to receive session lifecycle events.Duplicate listeners are not added.
- Parameters:
listener- the listener to register
-
removeListener
Removes a previously registered session listener.- Parameters:
listener- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
clearListeners
public static void clearListeners()Removes all registered session listeners.This method should be called during application shutdown to prevent memory leaks.
-
sessionCreated
public void sessionCreated(jakarta.servlet.http.HttpSessionEvent se) Called by the container when a new session is created.Notifies all registered listeners of the session creation.
- Specified by:
sessionCreatedin interfacejakarta.servlet.http.HttpSessionListener- Parameters:
se- the session event containing the new session
-
sessionDestroyed
public void sessionDestroyed(jakarta.servlet.http.HttpSessionEvent se) Called by the container when a session is about to be invalidated.Performs Oorian session cleanup via
Application.cleanupSession(OorianHttpSession)and notifies all registered listeners of the session destruction.- Specified by:
sessionDestroyedin interfacejakarta.servlet.http.HttpSessionListener- Parameters:
se- the session event containing the session being destroyed
-