tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Brogden <wbrog...@bga.com>
Subject Re: Session Close
Date Thu, 09 Nov 2000 03:22:05 GMT


romain@zzict.nl wrote:
> 
> On Wed, 8 Nov 2000, William Brogden wrote:
> 
> >
> >
> > Pablo Trujillo wrote:
> > >
> > > I need to execute a procedure when a session closes. Is this possible? How
> > > it is made?
> >
> > Make a class that is a HttpSessionBindingListener - attach an
> > object of this class to the session. When the session is destroyed
> > your object will get a call to the valueUnbound method.
> 
> this is the clean way of doing it.
> you could also add some object to the session,
> and do whatever you want in the finalizer.....
> 
> Dirty, but works.
> 
> Sloot.

The problems there are that
1) you don't have any guarantee as to when the finalizer will run.
2) if there is another reference to that object hanging around,
   it will never run.

-- 
WBB - wbrogden@bga.com
Author of Java Developer's Guide to Servlets and JSP 
ISBN 0-7821-2809-2

Mime
View raw message