I'm trying to use NDCs with servlets, and want to confirm that I'm doing so correctly.
Basically, I'm doing the following in doPost: if (user logs in OK) { NDC.push(currentUser.getCompanyId()); try { ... } finally { // log user out NDC.pop(); } NDC.remove(); Questions: 1. Will this work? 2. Is there a better way? 3. Is it OK to call NDC.remove() in the case where NDC.push() wasn't called (no context)? 4. Based on the code, it looked as though NDC.remove() would not remove the context for the current thread (due to lazy removal). Unfortunately, I don't know of any way to call it when the current request thread has terminated in a servlet. Will it properly remove previous thread contexts the way I'm calling it? 5. Is there a way to confirm that remove() is working? I looked into the debug logging for Log4j, and defined log4j.debug for Tomcat. This worked (I saw some debug output when the log properties were loaded), but I could never get any debug output from NDC.remove() (although there's debug logging in the NDC code). I'd like to be sure I'm not losing resources every time someone logs in to the servlet. Thanks much! ++++ Bill Sorensen, Programmer/Analyst, E-ASI Billing div. of ASItransact [EMAIL PROTECTED] http://www.asitransact.com/EASI_Billing.html -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>