Java синглтон и синхронизация
Пожалуйста, уточните мои вопросы, касающиеся Singleton и Multithreading:
What is the best way to implement Singleton in Java, in a multithreaded environment? What happens when multiple threads try to accessgetInstance()
method at the same time?
Can we make singleton's getInstance()
synchronized
?
Is synchronization really needed, when using Singleton classes?