While experimenting with clearing threadlocal in afterExecute, I found out that tomcat itself use ThreadLocal in hope of improving performance : - org.apache.catalina.util.DateTool - org.apache.catalina.valves.AccessLogValve - org.apache.tomcat.util.http.ServerCookie - ...
this is mainly to cache Date formatter or parsers... Sylvain On 29 avr. 2010, at 23:17, Caldarale, Charles R wrote: >> From: Sylvain Laurent [mailto:sylvain.laur...@gmail.com] On Behalf Of >> Sylvain Laurent >> Subject: Re: Need advice to notify StandardExecutor when a webapp is >> stopped >> >> Furthermore, there is probably some frameworks out there that >> do save things in ThreadLocals in a manner that does not cause >> classloader leaks but improve their performance. Cleaning their >> threadlocals after each request would decrease their performance. > > It would seem difficult to achieve any kind of consistent performance > improvement using ThreadLocal objects in conjunction with a thread pool. If > the server had a very limited number of webapps and the pool size were > reasonably small, the webapp could show improvement, but otherwise there's > little chance of a particular request being processed by a thread that has > already been enhanced with a ThreadLocal for that webapp. To me, it's much > cleaner and less disruptive to discard the ThreadLocal objects when a thread > returns to the pool, rather than making all webapps suffer when any one of > them is restarted. > > This is an area where some byte code modification might be appropriate in a > container environment, so that the ThreadLocal behavior could be modified to > be "ContextLocal" instead. > > - Chuck > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org