You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mikaël Cluseau <mi...@isinc.dyndns.org> on 2007/06/18 22:10:27 UTC

Re: T4: when a session http is closed?, where a session http is closed?

I think you are perfectly right, it was the answer I was going to give.
A session expire a given amount of minutes after the last request,
generally 30, so when your session expires, there have been 30 minutes
since the last ThreadLocal has been used.

If you want to clean a ThreadLocal, do it with a request filter.

If you need a special ressource bound to a user, you should use a
session because that special object won't be serializable. I think the
best way is to use a dedicaced service (probably a hivemind singleton
service) with its own timeout, and to build serializable façade that can
be stored in the session at low cost.

Le lundi 18 juin 2007 à 14:49 +0200, Renat Zubairov a écrit :
> The same question I'm asking myself.
> Usualy under threadLocal I understand
> 
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html
> 
> Which is a threaded storage for the objects in Java 1.4 (and later).
> It's a typical pattern for transaction,connection,resource management
> where transaction,connection,resource can not be shared between
> different threads. In this case it's just stored in the ThreadLocal
> and any other access to it from the same thread can read this
> instance.
> The problem described in the post is that Cesar want to clean up
> ThreadLocal variable in case HTTP Session is closed.
> 
> There are some problems with this approach - first is HTTP Session is
> more longer living object than any ThreadLocal because if Thread is in
> Web Applications is one request, then session span across multiple
> requests, which means by the time session is invalidated threadLocal
> will no longer exists.
> 
> Second problem is that even in case ServletFilter will be notified
> about Session expire event then Thread for this notification will not
> be associated with any of the HTTP Requests because Session expire
> happening usually when no requests from given client are done.
> 
> What do you think about it?
> 
> Renat
> 
> On 18/06/07, #Cyrille37# <cy...@gmail.com> wrote:
> > César Augusto Mateus a écrit :
> > > is some way to capture the moment at which a session HTTP is closed?
> > > (perhaps with a service in hivemind)
> > > I need to do this: clear a threadLocal just when the session http is
> > > closed.
> > > (Purpose: the threadLocal must be clean before returning to pool of
> > > threadLocals of the container )
> > > Any idea or way, thank you very much...
> > >
> > Hello,
> >
> > Just to teach me because I'm a beginner... Could you please tell me what
> > do you need to clean in the threadLocal ?
> >
> > Thanks
> > cyrille
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org