Singleton pattern and broken double checked locking in real world java application
- by saugata
I was reading the article Double-checked locking and the Singleton pattern, on how double checked locking is broken, and some related questions here on stackoverflow.
I have used this pattern/idiom several times without any issues. Since I have been using Java 5, my first thought was that this has been rectified in Java 5 memory model. However the article says
This article refers to the Java Memory
Model before it was revised for Java
5.0; statements about memory ordering may no longer be correct. However, the
double-checked locking idiom is still
broken under the new memory model.
I'm wondering if anyone has actually run into this problem in any application and under what conditions.