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




--
Best regards,
Renat Zubairov

Reply via email to