[concurrency-interest] Threadlocals and memory leaks in J2EE

Unmesh joshi unmesh_joshi at hotmail.com
Thu Oct 11 00:30:13 EDT 2007

Yes I should be using try-finally. Also, if I am using JDK1.4.2, where there is no remove method on threadlocal, threadloca.set(null), should also be Ok right?
Also, When I am not keeping value as object of any class in my web module (Keeping java.util.Map and only objects of string or other java.lang type in there), there is also no danger of having any memory leak on reload.

Date: Wed, 10 Oct 2007 21:17:17 -0700From: crazybob at crazybob.orgTo: unmesh_joshi at hotmail.comSubject: Re: [concurrency-interest] Threadlocals and memory leaks in J2EECC: concurrency-interest at cs.oswego.eduYou should remove the thread local in a finally block. See http://crazybob.org/2006/07/hard-core-java-threadlocal.html for examples.BobOn 10/10/07, Unmesh joshi <unmesh_joshi at hotmail.com> wrote: 

class FrontController {   public void handleReqeuest(HttpRequst request.....) {              Map requestContext = buildRequestContext(request);              RequestContextHolder.set (requestContext);               .....              Response response = handleRequest(request);              processResponse(response);              RequestContextHolder.clearContext();   }}
Check out some new online services at Windows Live Ideas—so new they haven’t even been officially released yet.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20071011/a89eb5f8/attachment-0001.html 

More information about the Concurrency-interest mailing list