tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Junghans <andreas.jungh...@fh-karlsruhe.de>
Subject Re: HttpSessionListener
Date Wed, 09 Oct 2002 10:29:47 GMT
John Baker wrote:

> I'm trying to write a bean so when sessions are closed, database 
> connections
> and other resources are released. I realise when the sessionDestroyed 
> method
> is called on HttpSessionListener the session is already invalidated (I 
> would
> like to know why such a design decision was made there, it seems 
> wrong).
> Anyway, as I need to be able to map stuff to a session I'm trying to 
> write a
> listener where I can say "For this newly created session, hold on to 
> this
> object". So when the session is destroyed, the object can be retrieved 
> and
> methods called upon it (such as close db connections).

This question should be directed at tomcat-user@jakarta.apache.org.

You're right that you cannot use HttpSessionListener since that is only 
an after the fact notification. For things like this, I usually use a 
session attribute that implements HttpSessionBindingListener. In its 
valueUnbound() method, you can perform cleanup actions for the session.

Regards

   Andreas Junghans


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message