design patterns

How to create a Singleton class properly in Java

A Singleton class is a class of which only one instance exists. There is a need for such a design pattern for loggers, database connections and other scenarios. The main challenge comes when you want to implement a Singleton in a mutli-threaded environment and ensure that all the threads are synchronised when creating the Singleton… read more »

Sidebar