IBM Interview Question
Developer Program EngineersCountry: India
Interview Type: Phone Interview
A singleton class will not work as Singleton in these situations
1. If not coded Thread safe
2. Across Process. Each JVM will have it's own Instance of Singleton
3. Using Multiple Class loaders can lead to multiple instances of same class
4. JVM before 1.2, Garbage collector will collect it if not maintained reference of Singleton
In java you can instantiate several instances of even correctly implemented singleton in case you are working with several classloaders.
- seirge July 18, 2012Another possible answer is 'in distributed environments'.