Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 4012 invoked from network); 28 Sep 2009 10:52:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Sep 2009 10:52:52 -0000 Received: (qmail 67101 invoked by uid 500); 28 Sep 2009 10:52:52 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 66979 invoked by uid 500); 28 Sep 2009 10:52:52 -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 66969 invoked by uid 99); 28 Sep 2009 10:52:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Sep 2009 10:52:51 +0000 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.219.227 as permitted sender) Received: from [209.85.219.227] (HELO mail-ew0-f227.google.com) (209.85.219.227) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Sep 2009 10:52:42 +0000 Received: by ewy27 with SMTP id 27so4740226ewy.40 for ; Mon, 28 Sep 2009 03:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=dJ3DX0H0tUClHrOgubj5Lo9yRvyZyt0MI4B80i6yGTE=; b=FziI7oHq8p8pXcxmizfz6XR7pLzkxVKq0GknbfwKWrpkU+8GTW8ceBLmTw/+8PY5df 3hVJguDSt/bf2NOnDugjC9b4FyhDSFB+A7aad1f+Di4OMm05uQLJBpgp42kaGR8X1bFp kZYkdGDLzw9KNiPS0wkAYjJ4bYmifNbVx+Xyk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=HuZgvRSxZWN4owFMiZyIVtB8epFeoOvdrkiyXjSObQ4l/C/vc81NHUIv4LTjjhXkg7 I5g7uFXmcu8UpbrgzoqN+irorbjTsUlhML7UkjNeqx4tjkkxGBiDQ6X+1IGizcp1L6QU dGf4OJR0YumLeqVkeVmOfG+CcAW1QKzmzQlwU= MIME-Version: 1.0 Received: by 10.216.25.201 with SMTP id z51mr787309wez.71.1254135140719; Mon, 28 Sep 2009 03:52:20 -0700 (PDT) In-Reply-To: <4AC06EBC.60208@btopenworld.com> References: <20090926142733.2C7592388906@eris.apache.org> <25aac9fc0909260748r72850ea6o4cbea2c3008de1d8@mail.gmail.com> <4ABE2C31.5010107@oliver-heger.de> <4ABE9D38.8070305@btopenworld.com> <25aac9fc0909271921t3b0999a9x43a338ceadb44af9@mail.gmail.com> <4AC06EBC.60208@btopenworld.com> Date: Mon, 28 Sep 2009 11:52:20 +0100 Message-ID: <25aac9fc0909280352ha698fado5632a2d3c7b5e3ff@mail.gmail.com> Subject: Re: svn commit: r819141 - in /commons/proper/lang/trunk/src: java/org/apache/commons/lang/concurrent/LazyInitializer.java test/org/apache/commons/lang/concurrent/ test/org/apache/commons/lang/concurrent/LazyInitializerTest.java From: sebb To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On 28/09/2009, Stephen Colebourne wrote: > sebb wrote: > > > Where is that described? The first reference I found says that the > > local variable is a performance optimisation; it's the volatile > > keyword that makes it thread-safe: > > > > > http://technology.amis.nl/blog/4384/the-double-checked-locking-confusion > > also > > > http://jeremymanson.blogspot.com/2008/05/double-checked-locking.html > > > > But of course these could be wrong... > > > > http://java.sun.com/developer/technicalArticles/Interviews/bloch_effective_08_qa.html > > "The idiom is very fast but also complicated and delicate, so don't be > tempted to modify it in any way" > That does not necessarily mean that the version without the temporary variable is wrong. As I see it, the fact that the variable is volatile is enough to ensure as-sequential operation, because the write of the volatile variable happens-before the read. > Stephen > > --------------------------------------------------------------------- > 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