Checkout the working code from my git hub repository using below link. It contains all possible ways of implementation of singleton with multi-thread issue which creates multiple instance of singleton.
Singleton is a part of Gang of Four design pattern and it is categorized under creational design patterns.
In Java the Singleton pattern will ensure that there is only one instance of a class is created in the Java Virtual Machine. It is used to provide global point of access to the object. This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects. In terms of practical use Singleton patterns are used in logging, caches, thread pools, configuration settings, device driver objects.
For example, if you have a license for only one connection for your database or your JDBC driver has trouble with multithreading, the Singleton makes sure that only one connection is made or that only one thread can access the connection at a time.