Ray, what did you end up doing in your case?  What do other people do when
using NDC's with Servlets/Web applications?  How expensive is it to call
NDC.remove() at the end of each request?

Thanks,
-Mark

-----Original Message-----
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 11:45 PM
To: LOG4J Users Mailing List
Subject: Re: When to call NDC::remove



Ray,

This is from the NDC javadoc:

Heavy duty systems should call the remove() method when leaving the run
method of a thread. This ensures that the memory used by the thread can be
freed by the Java garbage collector. There is a mechanism to lazily remove
references to dead threads. In practice, this means that you can be a little
sloppy and sometimes forget to call remove() before exiting a thread. 

The problem in your case is that you do not control the life cycle of the
calling thread. Have you considered calling NDC remove at the end of the
HTTP request? Regards, Ceki

ps: Interesting problem by the way.

At 17:13 14.08.2001 -0500, Millard, Ray wrote:
>We are working in a J2EE Model II environment.  In various mail threads,
>users have mentioned that there are several possible locations to call
>NDC::remove, however, I haven't been able to find a thread that mentions
>exactly where different organizations are calling it.  I have thought about
>the following scenario:
>
>1. In the doGet/doPost, call NDC.push("something unique about the user");
>2. At the end of the doGet/doPost call NDC.pop();
>3. In the servlet finalize method call NDC::remove.
>
>I am not sure that this scenario will work to reclaim the memory, as I do
>not know if the log4J framework holds a reference to the servlet and thus
>prevents the finalize method from being called.  If you are using NDCs in a
>Model II environment, please respond back with your NDC scenario.
>
>Thanks!

--
Ceki Gülcü - http://qos.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to