As to the post that singleton is considered a bad practice no comments
If you really need the concept of a singleton than there are better ways to handle resource management for example. They will save you a lot of trouble.
We can prevent this by keeping the following section in a synchronized block but this would create an performance overhead.
Could you please suggest what can be an alternate way to implement the singleton concept ?
Kengkaj Sathianpantarit wrote:We aren't allowed to create a instance directly because the constructor is private or protected so we have to use a public static method to get the instance.