Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7110

Re: Synchronization of the constructor

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Synchronization of the constructor
Date Sun, 14 Aug 2011 11:28:52 -0700
Organization A noiseless patient Spider
Lines 24
Message-ID <j2945d$7hh$1@dont-email.me> (permalink)
References <j25hro$cjf$1@news.onet.pl> <j25uri$vm$1@dont-email.me> <j264b6$3u5$1@dont-email.me> <e46c0cd1-9906-4195-9d30-070318fa5318@y39g2000prd.googlegroups.com> <j28msd$cmd$1@dont-email.me> <j28nec$ggg$1@dont-email.me> <1b39f46d-0268-413a-9383-3a4a2c73920d@glegroupsg2000goo.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Sun, 14 Aug 2011 18:29:01 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="7729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UWR1qLs4FHxypjB5pJgBzROL6pCwe27Y="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0
In-Reply-To <1b39f46d-0268-413a-9383-3a4a2c73920d@glegroupsg2000goo.googlegroups.com>
Cancel-Lock sha1:Ed7oKWIzt/tSKFNUZzI0Ttdg3pk=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7110

Show key headers only | View raw


On 8/14/2011 9:10 AM, Lew wrote:

> See JLS ยง17.5: "...It will also see versions of
> any object or array referenced by those final fields that are at
> least as up-to-date as the final fields are."
>

This is a little misleading, I think.  In fact the update does not occur 
when the final field is written ("at least as up-to-date as the final 
fields are").  The update occurs at the end of the constructor.

JLS 17.5.1:
"The semantics for final fields are as follows. Let o be an object, and 
c be a constructor for o in which f is written. A freeze action on a 
final field f of o takes place when c exits, either normally or abruptly."

The "freeze action" is a little unclear.  It's not technically a 
synchronization, because immutable objects are specifically stated to 
not use synchronization.  It is a happens-before though (even though 
that language isn't used), and it appears to imply a memory-barrier.

I'm not sure exactly why they use "freeze action" and not 
happens-before.  There might be some subtle difference for compiler 
writers, than doesn't affect the rest of us.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Synchronization of the constructor MaciekL <__nospam__maclab@o2.pl> - 2011-08-13 11:58 +0200
  Re: Synchronization of the constructor Robert Klemme <shortcutter@googlemail.com> - 2011-08-13 12:17 +0200
    Re: Synchronization of the constructor "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-08-13 21:36 +1000
      Re: Synchronization of the constructor Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-13 09:30 -0300
    [OT] Natural language. Was: Re: Synchronization of the constructor Patricia Shanahan <pats@acm.org> - 2011-08-13 07:10 -0700
  Re: Synchronization of the constructor Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-13 09:36 -0400
    Re: Synchronization of the constructor markspace <-@.> - 2011-08-13 08:13 -0700
      Re: Synchronization of the constructor Lew <lewbloch@gmail.com> - 2011-08-13 09:23 -0700
        Re: Synchronization of the constructor Patricia Shanahan <pats@acm.org> - 2011-08-13 10:04 -0700
          Re: Synchronization of the constructor Lew <lewbloch@gmail.com> - 2011-08-13 21:29 -0700
            Re: Synchronization of the constructor kedar mhaswade <kedar.mhaswade@gmail.com> - 2011-08-13 23:16 -0700
            Re: Synchronization of the constructor "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-08-15 14:24 +1000
              Re: Synchronization of the constructor Lew <lewbloch@gmail.com> - 2011-08-14 23:03 -0700
      Re: Synchronization of the constructor kedar mhaswade <kedar.mhaswade@gmail.com> - 2011-08-13 23:12 -0700
        Re: Synchronization of the constructor markspace <-@.> - 2011-08-14 07:42 -0700
          Re: Synchronization of the constructor markspace <-@.> - 2011-08-14 07:51 -0700
            Re: Synchronization of the constructor Lew <lewbloch@gmail.com> - 2011-08-14 09:10 -0700
              Re: Synchronization of the constructor markspace <-@.> - 2011-08-14 11:28 -0700

csiph-web