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.
Auf dieser Seite können Sie das Online-Video Thread-safe singleton implementation in Java mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Java Web Development 13 Oktober 2014 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 13,026 Mal angesehen und es wurde von 133 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!