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 Details

    • OorianSessionMonitor

      public OorianSessionMonitor()
  • Method Details

    • addListener

      public static void addListener(OorianSessionListener listener)
      Registers a session listener to receive session lifecycle events.

      Duplicate listeners are not added.

      Parameters:
      listener - the listener to register
    • removeListener

      public static boolean removeListener(OorianSessionListener listener)
      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:
      sessionCreated in interface jakarta.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:
      sessionDestroyed in interface jakarta.servlet.http.HttpSessionListener
      Parameters:
      se - the session event containing the session being destroyed