2 Replies Latest reply on Sep 11, 2012 11:56 PM by Vikas V

    Session invalidation not happening at the right time

    Vikas V Newbie



      Am using Jboss AS 5.1.0 GA. I have JSF 1.2 servlet running on it.


      I have a Customised session listener which extends PortalSessionListener (am running Liferay 6.0)


      In web.xml, I have configured session-timeout to be 3 minutes. When I hit my JSF servlet, and dont do any thing for 3 mins, then my customised session listener gets invoked and sessionDestroyed(HttpSessionEvent httpSessionEvent) is called.


      Before 3rd minute if I carry out some activity on my servlet then the session gets extended. Then I wont do anything. This time if I watch the logs, my customised session listener is getting called at around 2nd minute instead of 3rd minute and its invalidating the session by calling sessionDestroyed(HttpSessionEvent httpSessionEvent).


      My first question is why is that session invalidation not happening at the right time in the scenario described above?


      Also, I have configured a session-timeout in web.xml of my Servlet. Am using httpServletRequest.isRequestedSessionIdValid() method to check if the session is valid or not. In the above scenario

      when session got invalidated at around 2nd minute, this time after the session invalidation log got printed, if I click on any page on my Servlet it still finds that session is not invalidated yet.

      But, its finding the session got invalidated only exactly after 3rd minute.


      My second question is why is this difference between session-timeout configured in Jboss AS web.xml and the one configured in Servlet's web.xml?