Avinash Tiwari wrote:Is there any alternative to double check locking.
Or using volatile and another instance reference in the method we can solve it.
Mike Simmons wrote:Ummm, to reiterate my last post, as applied to Anayonkar Shivalkar's post: the variable "map" really, really needs to be volatile there. Or your code DOES NOT WORK. Not reliably, anyway. (And also you need to be using at least JDK 1.5, but that's almost a given, these days.)