: > I am fairly certain his code is ok, since it rechecks the initialized state : > in the synchronized block before initializing. : : That "recheck" is why the pattern (or anti-pattern) is called : double-checked locking :-)
More specificly, this is functionally half way between example labeled 'Broken multithreaded version' and the example labeled '(Still) Broken multithreaded version' http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html An optimizing compiler can freely optimize away the m_indexTerms variable so the new readIndex function directly modifies this.indexTerms, and the JVM can allocate RAM for the array and set the variable to point at this RAM before the array is fully populated. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]