How might a person simulate firing the HttpSessionListener.sessionDestroyed object in a session listener?
Is just setting the Tomcat session timeout to 1 and then waiting the only way?
How might a person simulate firing the HttpSessionListener.sessionDestroyed object in a session listener?
Is just setting the Tomcat session timeout to 1 and then waiting the only way?
Use HttpSession.invalidate()
. Alternatively, you can call setMaxInactiveInterval()
with a small number (i.e. 1). This is less reliable as there's no guarantee as to when Tomcat will destroy the session.