简体   繁体   中英

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.

Eg if i add/remove an element to Hashmap

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

Your "singleton" is one instance per JVM.

Here is a good article discussing classloaders, the relationship between different classloaders to each other, and to the JVM:

http://javapapers.com/core-java/java-class-loader/

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

there are couple of good references:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM