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 [EMAIL PROTECTED]

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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to