Blogger

Delete comment from: Javarevisited

Anonymous said...

I read your blog often, however, I think you made a mistake in the following line

"....all other thread will not be able to see value of _instance as not null and they will believe its still null."


It should be more like " all other threads will see the partially constructed value of _instance and return the value thinking it is not null."

This is according to wikipedia..http://en.wikipedia.org/wiki/Double-checked_locking

Jun 10, 2012, 8:39:14 PM


Posted to How Volatile in Java works? Example of volatile keyword in Java

Google apps
Main menu