lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Multiple threads searching in Lucene and the synchronized issue. -- solution attached.
Date Wed, 10 May 2006 04:16:58 GMT

: > 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message