Double Checked Locking Singleton Pattern

The Singleton Design Pattern is one of the most used patterns for providing a single instance of an object. It is thought to be made Thread-Safe by having Double-Check Locking eliminate the possibility of having 2 instances of the object made by 2 separate threads. While this is true, it does still allow a possible memory exception. The following paper http://erdani.com/publications/DDJ_Jul_Aug_2004_revised.pdf shows that when looking to use a Singleton, there are alternatives that provide better thread safe protection.




Comments

Popular posts from this blog

LEARN THE DIFFERENCE BETWEEN COMPUTER SCIENCE AND IT

7 AWESOME BENEFITS OF TRAINING IN MIXED MARTIAL ARTS

Important Tips to Rock the Coding Technical Interview!