JavaMemoryModel: class initialization (was: Idiom for safe, unsynchronized reads)

From: Paul Haahr (
Date: Mon Jul 05 1999 - 14:30:04 EDT

> By the way, we should also guarantee class initialization safety:
> that lack of synchronization doesn't allow you to see the results of
> an incompletely executed class initializer.

My naive understanding is that that's guaranteed by the rules in 12.4.2
of the JLS, which requires a class initializer to synchronize on the
class object.

The worry, I guess, is of a second processor seeing a class as ``fully
initialized,'' but not seeing all the static fields as fully initialized.
But, on the other hand, to properly the detect the class as initialized,
that processor is probably required to insert a memory barrier.

This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email
To send a request to the list, email and put
your request in the body of the message (use the request "help" for help).
For more information, visit

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:15 EDT