educative.io

Educative

Double-Checked Locking of singleton instance

The above solution marks the singleton instance volatile however the JVM volatile implementation for Java versions 1.4 will not work correctly for double checked locking and you’ll need to use another way to create your singletons.

The double checked locking is now considered an antipattern and its utility has largely passed away as JVM startup times have sped up over the years.

Unable to understand double-checked locking and its volatility. How it’s making singleton instance
volatile.