Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

HttpSessionBindingListener Problem in Tomcat 4.1.18

Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Tomcat 4.1.18, and i want to do some database operation when the session times out. As per servlet 2.3 spec, valueUnbound has to be called on the object which implements HttpSessionBindingListener, It looks like tomcat is not calling that.
Is there any other way, or am i wrong in saying that tomcat is not working ?
Thanks & Regards,
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From section 7.4 of the spec:
The valueUnbound method must be called after the object is no longer available via the getAttribute method of the HttpSession interface.

Which is true if the session times out, right? The language of this particular section of the spec allows this fuzzy interpretation. What's more important to realize here is that if a session has expired, then NONE of the objects previously bound to it are avaiable, since the session itself is unavailable. The session unavailability 'supercedes' the unavailability of any object bound to that session. So perhaps there is no clear-cut requirement for the HttpSessionBindingListener to be notified.

From the API for Session.removeAttribute method:
After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueUnbound.

Here we find the normal course of events that triggers a notification of valueUnbound.

Check out section 10 of the spec, 'application lifecycle events' and the HttpSessionListener interface.
[ October 26, 2003: Message edited by: Mike Curwen ]
Nothing up my sleeve ... and ... presto! A tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic