[jboss-user] [Beginner's Corner] - Session invalidation not happening at the right time

Vikas V do-not-reply at jboss.com
Tue Sep 11 01:03:32 EDT 2012

Vikas V [https://community.jboss.org/people/selfcare] created the discussion

"Session invalidation not happening at the right time"

To view the discussion, visit: https://community.jboss.org/message/758914#758914


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?*



Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120911/033a0aec/attachment.html 

More information about the jboss-user mailing list