Making the constructor private and using a static getter method only, your singleton object will not be able to survive in multi-thread or multi CPU environment. We will look for a soluton to singleton usage problem in multithread environment. First attempt will be double-locking mechanism, then we will use volatile keyword to complete the task.
This is a production of www.javathlon.com.
Happy learning.
On this page of the site you can watch the video online Thread-safe singleton implementation in Java with a duration of hours minute second in good quality, which was uploaded by the user Java Web Development 13 October 2014, share the link with friends and acquaintances, this video has already been watched 13,026 times on youtube and it was liked by 133 viewers. Enjoy your viewing!