In my previous article “Double-Checked Locking: Clever, but Broken,” I looked at some of the problems with double-checked locking (DCL), an idiom recommended by a number of Java books and articles as ...
Usually when there are multiple threads sharing an object we need to synchronize the critical section of the code in order to make it thread safe. ThreadLocal class in Java provides another way of ...