JavaMemoryModel: Final clarification on volatiles

From: David Holmes (
Date: Thu May 02 2002 - 22:28:07 EDT

Just confirming. The "happens before" relationship established between
volatile reads and writes only applies to use of the *same* volatile
reference - independent of the object referred to - right? So that the

class Holder {

   volatile int[] store = new int[10];

   Helper helper = new Helper(store);

   // ... methods to read/write store elements

class Helper {

   volatile int[] store;

   Helper(int[] theStore) {
       store = theStore

   // ... methods that read store elements

does *not* establish any relationship between uses of and

So I'll need to use an inner class to access directly.

David Holmes

JavaMemoryModel mailing list -

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