You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Assefa Yewondwossen <as...@dmsolutions.ca> on 2001/04/13 00:54:49 UTC

session timeout

Hi There,

I would like to be able to track a session's time out (in a servlet). In

fact all I want to do is to be able to make some clean up (tmp files)
when a session expires.
Are there any examples available that could help me do this ?

Thanks,
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa@dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056
----------------------------------------------------------------



Re: session timeout

Posted by christophe dore <cd...@audientia.com>.
I think there is a simpler way...

You can have an class implementing the
javax.servlet.http.HttpSessionBindingListener. Instantiate an object in
each session (the easiest in to set it as a session-scope bean).

when it will receive the valueUnbound message, the session is being
removed from the server. As it is not a destructor, you can do whatever
you want with it.


David Crooke a écrit :
> 
> Attach your own object to the HttpSession, and put a destructor on it - use this
> to detect the session has finished. Don't rely on doing complex stuff like I/O
> in a destructor, instead pass the list of files to delete into a queue handled
> by a background thread.

-- 
Christophe Doré
Project Manager
Audientia
+33 (0)1.46.22 94 57 (office - direct)
+33 (0)1.46.22.40.00 (office - std) 
+33(0)1. 46.22.33.04 (fax) 
12 rue Le Châtelier-75017 Paris - France
http: //www.audientia.com 
---
The information transmitted is intended only for the person to whom or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or other
use
of, or taking of any action in reliance upon, this information by
persons or
entities other than the intended recipient is prohibited.If you received
this in error, please contact the sender by e-mail reply and delete and
destroy all copies of the material.

Re: session timeout

Posted by David Crooke <da...@convio.com>.
Attach your own object to the HttpSession, and put a destructor on it - use this
to detect the session has finished. Don't rely on doing complex stuff like I/O
in a destructor, instead pass the list of files to delete into a queue handled
by a background thread.