In the above code, getInstance() method is not
thread safe. Multiple
threads can access it at the same time and for the first few
threads when the instance variable is not initialized, multiple
threads can enters the if loop and create multiple instances and break our
singleton implementation.
read more >>