correction: The double checked idiom was "fixed" in java5. The variable which is checked needs to be declared as volatile. The link states that at the bottom.

-Tim

Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 6/14/2009 5:43 PM, David Blevins wrote:
Regardless of that choice we
will still handle sychronization of instantiation, so
double-check-locking or other things will not be necessary.

NB: DCL does not work in Java. Period.

http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

There are cases where you /can/ make it work, but let's face it: most
programmers simple cannot be trusted to do it properly. Also, the
techniques are very sensitive to JVM level, etc. so you'd need to have a
different implementation depending on which JVM you were running. Yuk.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to