On 17/12/2010 15:38, Srikanth Konjarla wrote:
> 
> 
> On 12/17/10 3:01 AM, Pid wrote:
>> On 15/12/2010 15:37, Srikanth Konjarla wrote:
>>>
>>>
>>> On 12/15/10 7:13 AM, Pid wrote:
>>>> On 15/12/2010 02:40, Srikanth Konjarla wrote:
>>>>> I could catch Axis threadlocals from the app to clean up. However, I
>>>>> have a question wrt following tomcat's log at the time of undeploy of
>>>>> app. The message suggests that it is removing the same threadlocal
>>>>> twice. Is it because it was not removed in the first attempt?
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> ec 15, 2010 1:05:28 AM org.apache.catalina.loader.WebappClassLoader
>>>>> clearThreadLocalMap
>>>>> SEVERE: A web application created a ThreadLocal with key of type
>>>>> [java.lang.ThreadLocal] (value [java.lang.threadlo...@14213040]) and a
>>>>> value of type [org.apache.catalina.loader.WebappClassLoader] (value
>>>>> [WebappClassLoader
>>>>>   delegate: false
>>>>>   repositories:
>>>>>     /WEB-INF/classes/
>>>>> ----------> Parent Classloader:
>>>>> org.apache.catalina.loader.standardclassloa...@6ee3849c
>>>>> ]) but failed to remove it when the web application was stopped. To
>>>>> prevent a memory leak, the ThreadLocal has been forcibly removed.
>>>>> Dec 15, 2010 1:05:28 AM org.apache.catalina.loader.WebappClassLoader
>>>>> clearThreadLocalMap
>>>>> SEVERE: A web application created a ThreadLocal with key of type
>>>>> [java.lang.ThreadLocal] (value [java.lang.threadlo...@14213040]) and a
>>>>> value of type [org.apache.catalina.loader.WebappClassLoader] (value
>>>>> [WebappClassLoader
>>>>>   delegate: false
>>>>>   repositories:
>>>>>     /WEB-INF/classes/
>>>>> ----------> Parent Classloader:
>>>>> org.apache.catalina.loader.standardclassloa...@6ee3849c
>>>>> ]) but failed to remove it when the web application was stopped. To
>>>>> prevent a memory leak, the ThreadLocal has been forcibly removed.
>>>>> --------------------------------------------------------------------
>>>>
>>>> I don't think this is from Axis, does your code check other sources?
>>> Right. This is not from Axis. This is from one of the components of the
>>> app. I am wondering why the threalocal is not cleared at first time? 
>>
>> Are you generically clearing all ThreadLocals, or just Axis related ones?
> I am clearing ThreadLocals pertaining to Axis. Also, clearing all
> threadlocals from context listener during "destroy" process of the webapp.

This runs in a different thread.  You need to clear each request thread
after use.  A Servlet Filter can do that, by calling the doFilter method
before clearing the thread.

 public void doFilter(ServletRequest req, ServletResponse res) {

  HttpServletRequest hreq = (HttpServletRequest) req;
  HttpServletResponse hres = (HttpServletResponse) res;

  chain.doFilter(hreq, hres);
  myClearThreadLocals();

  private void myClearThreadLocals() {
    // ... etc
  }

}

>>> Or is it one each for "threadLocals" and "inheritedthreadLocals"?
>>
>> Yes, you need to clear them separately.
> Right. The code mimics tomcat's cleaning process that exists in
> "WebappClassLoader" class.
> 
> Srikanth
> 
>>
>>
>> p
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

Attachment: 0x62590808.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to