Singleton & Multithreading in Java
- by vivek jagtap
What is the preferred way to work with Singleton class in multithreaded environment?
Suppose if I have 3 thread, and all they try to access getInstance() method of singleton class at the same time -
What would happen if no synchronization is maintained?
Is it good practice to use synchronized getInstance() method or use synchronized block…