-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nick,

On 2/22/12 7:52 PM, Nick Williams wrote:
> Now, at the end of each request, I am calling:
> 
> threadLocalInstance.set(null);
> 
> threadLocalInstance.remove();

If you are creating a ThreadLocal for each request (that needs the
object) and then disposing of it, why bother with the ThreadLocal in
the first place? Is this a case of wanting global-variable semantics
and just being lazy about (not) passing arguments around?

> I’m still getting these four messages, and I can’t seem to get them
> to go away. But I have tracked down these specific instances and I
> *am* calling set(null) and remove() on these instances.

Does it always happen? Perhaps you are encountering an exception and
your .remove() isn't being called in certain cases. Consider a
'finally' block?

> Is something about the Tomcat code somehow locating “phantom”
> references to ThreadLocals that have actually been removed and ARE
> really eligible for GC, or am I really just not always clearing
> those ThreadLocals and I just still haven’t tracked down the
> source?

Tomcat just looks at the ThreadLocals still left over in a Thread
after your webapp is stopped. There's nothing "phantom" about them.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9K7icACgkQ9CaO5/Lv0PBFsgCfT1Y+Mj4C40rwNUAp1wk38e+e
m1IAn22T17lUBZAQ3t9zYBoll5TzEL30
=3Ndj
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to