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

Bill,

On 8/31/2010 4:49 PM, Bill Davidson wrote:
> On 8/31/2010 12:16 PM, Christopher Schultz wrote:
>> Or, just remove the ThreadLocal manually. Since you know it's name, it
>> should be easy to remove. There are two obvious ways to remove these
>> ThreadLocals in a webapp:
>>
>> 1. Modify all the code that uses the iCal4j library so that, after
>> performing it's iCal4j operations, you manually remove the ThreadLocals.
>>    
> 
> I don't understand how to do that.  I have local objects that I create from
> the library.  Once I'm done with them, they go out of scope and are given
> to the garbage collector.  However, the ThreadLocal's are static to the
> class, and the library offers no way to access them.  Is there some way to
> find them?
> 
> Hmm, now that I think about it, Tomcat found them.  I guess I should
> look at the Tomcat source.

The most convenient thing would be for the library author to provide a
"cleanup" method. Tomcat uses reflective tricks to probe the ThreadLocal
map and purge it.

>> 2. Write a Filter that removes any ThreadLocals once the request has
>> been completed.
> 
> Again, I'm not sure how to do that.

Once you figure out how to do the above, writing a Filter is simple:
just implement the javax.servlet.Filter interface and configure your
class in web.xml. Your "doFilter" method just includes whatever code
works above.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx+aToACgkQ9CaO5/Lv0PAU8ACZAcSQ0I+ZuGMaHwNfzTP90CuX
/10AoIxYnF4xon31W8dqd8mC/ieYZEKi
=ktUb
-----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