Which listener to use? SessionListener is not useful since its method is called after session is removed. SessionAttributeListener is not useful since in attributeRemoved() I still can�t get object in session. I got �Session already invalidated� message if I try Session.getAttribute() no matter the session expires or invalidated explicitly. Any suggestions? Thanks.
BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design
Bruce, Are you trying to access an object in the session after the session is invalidated? These objects can be garbage collected at any time after the session is invalidated. What is in the object that you want to clean up?
If you wanna release resource when a session is being invalidated, you can use HttpSessionBindingListener. If a data implements HttpSessionBindingListener, it will be notified if a session is being invalidated. In the valueUnbound method, you can add some code to relese resource. Hope it helps. Dan
Thanks for the response. I my case, the connection is user specific. Each user has his own work mode such as schema set (in our AS/400 world, it is library list and it is included in the connection, believe or not). I am coding applications for known users not for the web public at large.