Search code examples
javasingletonclassloader

Impact of changes on singleton class loaded by different classloaders


If i have multiple instances of singleton class on different class loaders
and if i have modifications to a reference variable in any of these instances.

E.g if i add/remove an element to Hashmap

Does the change/modification impact the instances on other class loaders as well?


Solution

  • Singleton is per classloader. so changes wont impact other instances loaded using other classloaders.

    there are couple of good references: