>I was just wondering. When a class gets loaded, does the Java memory
>model state which thread executes the static initializer (if there is one
>of course) of the class?
>
The class is not initialized when it is loaded. Rather, the first
active use of a thread causes the class to be initialized, and
synchronization is used to ensure that other threads see the results
of the initialization.
See Section 12.4 of the Java Virtual Machine spec for a detailed explanation:
http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:40 EDT