Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 42832 invoked from network); 16 Sep 2008 14:58:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Sep 2008 14:58:22 -0000 Received: (qmail 99974 invoked by uid 500); 16 Sep 2008 14:58:17 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 99894 invoked by uid 500); 16 Sep 2008 14:58:17 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 99883 invoked by uid 99); 16 Sep 2008 14:58:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2008 07:58:17 -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 209.85.217.12 as permitted sender) Received: from [209.85.217.12] (HELO mail-gx0-f12.google.com) (209.85.217.12) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2008 14:57:19 +0000 Received: by gxk5 with SMTP id 5so25907726gxk.18 for ; Tue, 16 Sep 2008 07:57:51 -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=T4TZNhC/rDRS7WMIHVwmXqrW8y4GDwwOFxngH6qh6xg=; b=ElnOBKzOFn5eFeX+ZYKTNQQy1ae2TtPVTkxI/XA0WXRIxTqKrQHDge46MdMoKwqNxj 81Q+cGzyqX2NQDCMMbsTituWM6121tI/VX/LY1i4WPwVQHWepJmUrbKnQ2+Gzs94UnGW 2PrLiLsuPB+3HphaLngYlOzQ9RrbVVFYqnnzQ= 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=GVm+kPzImhboLC9L15ohHuge4xFMs8IT5oKyks9cM3MwD2hsj8SnprfGe4q9SPCnsQ t6akUJBCYAw3cbRfDmJ2jEzYCHAM+MUr/U4tbYpS7/lVQ3vzrrC6fssSwcUQF/2fxMT2 HtVjNGtp9SW2cPPJmMLwV0j6tb9LirpiMXVCM= Received: by 10.86.80.5 with SMTP id d5mr851002fgb.26.1221577069636; Tue, 16 Sep 2008 07:57:49 -0700 (PDT) Received: by 10.86.65.7 with HTTP; Tue, 16 Sep 2008 07:57:49 -0700 (PDT) Message-ID: <25aac9fc0809160757kd9a2547u5a006962d726d68@mail.gmail.com> Date: Tue, 16 Sep 2008 15:57:49 +0100 From: sebb To: "Commons Developers List" Subject: Re: [LANG] - suggestions for new Identity Hash code classes In-Reply-To: <48CFC5D4.40800@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <25aac9fc0809160449k2d1a8c08i82528309955b6a1e@mail.gmail.com> <48CFAA1E.30501@apache.org> <25aac9fc0809160556v1209d933h2d0daaa617056b2b@mail.gmail.com> <48CFB33B.8090601@apache.org> <25aac9fc0809160638m324a8811g6a9c3e01be73041c@mail.gmail.com> <25aac9fc0809160728x4e3d7b5djd8fa0d4768d848e7@mail.gmail.com> <48CFC5D4.40800@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org On 16/09/2008, Simon Kitching wrote: > sebb schrieb: > > > On 16/09/2008, J=F6rg Schaible wrote: > > > > > > > sebb wrote: > > > > On 16/09/2008, Simon Kitching wrote: > > > > > > [snip] > > > > > > > > > > > > > > > > > > It's not quite clear to me why a threadlocal is being used here. > I'm > > > > > > > > > > > > > > > > > >> guessing it is for performance to avoid recreating the HashSet > > > >> object. > > > > > > > > I don't know for sure, but that is probably the case. > > > > > > > >> Or is > > > >> it to "tunnel" the registry set between cooperating classes? > > > > > > > > Not at present, although the registy access methods are > > > > package protected. > > > > > > > > That may be a mistake... > > > > > > > > > My guess: It's used in case of a circular object graph ... > > > > > > > > > > > > > Yes, they are used in the enclosing class for just that purpose. > > > > But as far as I can see there is no need for the methods to be > > anything other than private - and the contents of the HashMap only > > contain anything during the calculation of the hashcode, so it's not > > obvious how the methods could be called anyway. > > > > I meant it was probably a mistake for the methods to be package protect= ed. > > > > > In that case, I wonder why it bothers to use a thread-local at all, rath= er > than just passing the registry object around as a parameter... > > Is the performance benefit of avoiding creation of a HashSet object real= ly > measurable given that this class is doing significant amounts of reflecti= on? > > Because this class never calls ThreadLocal.remove(), the created HashSet > object will remain attached to every thread that ever was active when a > HashCodeBuilder call was made. That's not *too* bad, ie it seems to me th= at > it would be acceptable as long as there was a corresponding benefit > somewhere. But I can't see the benefit ATM.. Ditto. I think it would make also sense to privatise the add/remove etc methods. However, this would change the API. But as that part of the API seems to be useless, I would not object to it being removed. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org