[concurrency-interest] synchronized constructors

Zhong Yu zhong.j.yu at gmail.com
Fri Dec 16 14:03:36 EST 2011


I can only reason concurrency based on JMM (as in the Java Language
Spec); beyond that I have no idea.

My understanding is that JMM allows such reordering (in effect)

Zhong Yu

On Fri, Dec 16, 2011 at 3:48 AM, Roland Kuhn <rk at rkuhn.info> wrote:
> As I was recently made aware: the rules for write reordering are not as weak as you think.
>
> http://java.sun.com/docs/books/jvms/second_edition/html/Threads.doc.html#24432
>
> Section 8.8 of the JVM spec requires that a write cannot be moved earlier across a “lock” operation. This means that a synchronized {} in the constructor solves the issue.
>
> Regards,
>
> Roland



More information about the Concurrency-interest mailing list