Singleton pattern and broken double checked locking in real world java application

Posted by saugata on Stack Overflow See other posts from Stack Overflow or by saugata
Published on 2010-03-20T05:40:10Z Indexed on 2010/03/20 5:41 UTC
Read the original article Hit count: 381

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about singleton