Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 34679 invoked from network); 1 Oct 2008 12:19:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Oct 2008 12:19:53 -0000 Received: (qmail 52113 invoked by uid 500); 1 Oct 2008 12:19:44 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 52053 invoked by uid 500); 1 Oct 2008 12:19:44 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 52042 invoked by uid 99); 1 Oct 2008 12:19:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 05:19:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 72.14.220.155 as permitted sender) Received: from [72.14.220.155] (HELO fg-out-1718.google.com) (72.14.220.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 12:18:43 +0000 Received: by fg-out-1718.google.com with SMTP id 16so416254fgg.40 for ; Wed, 01 Oct 2008 05:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=xxrsblYsau0OdgUA+gMFBuDt7RtmQ3jE7NX+ZLxxhlc=; b=dqASmGoYtJf2+wS16hjkc+ZJKE5f9YRtwty4TilHneLzm1fFbfCjUizj2X9ansOw1B NZixA8APjmciqF48nYWUfYfICk+jruRhlHs0dh+P8LibUNmr0STSFUd8qQV5oZ6VA97X YLKU05zxWkrZ6hg0huLmEp/tg011OtnHlUb6w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=daQDZjY8D+j5G0Xx4mig5gJJAc7m57BJEFnZlBgWcdICVS0DsEzHIudz/XrK7s4Vtf Kngao4HW6PPT7N0CMY58Sxc6TLaRqgI5niSKJac8+Zp/a6JS9PXqv5SqUIVVox1dBViS CZZUz3zn+fTJT4STcdT/16RI+xHxTYj0UxTJc= Received: by 10.86.92.7 with SMTP id p7mr7032481fgb.8.1222863556867; Wed, 01 Oct 2008 05:19:16 -0700 (PDT) Received: by 10.86.1.2 with HTTP; Wed, 1 Oct 2008 05:19:16 -0700 (PDT) Message-ID: <25aac9fc0810010519o4d31638dqca8d3e727524d7ed@mail.gmail.com> Date: Wed, 1 Oct 2008 13:19:16 +0100 From: sebb To: "Tomcat Developers List" Subject: Re: svn commit: r700170 - /tomcat/tc6.0.x/trunk/STATUS.txt In-Reply-To: <48E1271C.90906@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080929163035.B4F04238898F@eris.apache.org> <25aac9fc0809290945r20f1e874o4189b34ca5ae68c1@mail.gmail.com> <48E1165D.5010105@apache.org> <25aac9fc0809291112n14b07b71w1d6c24824fc6284e@mail.gmail.com> <48E1271C.90906@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org On 29/09/2008, Mark Thomas wrote: > sebb wrote: > > On 29/09/2008, Mark Thomas wrote: > > >> ThreadLocals and container classloader environments need careful handling > >> to avoid memory leaks. > > > > I would have thought that was a good reason to keep the class - one > > only needs to get the code right once? > > If you don't use ThreadLocal, the code is much simpler so there is little > to be gained by using a utility class. In this case of the two formats that > were still used, one class was using each. It makes more sense to me to put > the code specific to a class in that class and do away with what was a > broken, deprecated and little used utility class. > > > >> In this case the pain to make sure there wasn't a memory leak wasn't worth the gain. > > > > OK, point taken w.r.t. using synchronisation - the code should be > > reasonably quick. > > > > But why not use an instance variable rather than a static class variable? > > If there is more than 1 instance, each instance will have its own lock. > > Which may share the load better. > > Creating the object is likely to be more expensive than using it. True I > haven't tested it and if you have performance figures that suggest > otherwise then it may be worth changing. I don't know how the classes are used in Tomcat, but if each instance is used many times, then the object creation cost needs to be compared against the cost of multiple synchronisations. If each instance is used only once - or only by a single thread - then the synchronisation can be eliminated entirely. But I have not done any tests to show which approach performs better. > > Mark > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org > For additional commands, e-mail: dev-help@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org