jv patel wrote:Hello everyone,
in the code, why using double sync check on map instead of using enum for singleton design pattern
I assume you mean "Double-checked locking". There is no reason to ever use DCL in Java. In fact, before 1.3 or 1.4, the memory model allowed that idiom to fail. I can work in later versions, but there's still no reason to ever use it. I may give very, very small performance gains in lazily instantiated singletons, but there's no reason to lazily instantiate a singleton anyway.
Just forget DCL exists entirely. It's broken and useless.
Been there. Done that. Went back for more. But this time, I took this tiny ad with me: