문제

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?

도움이 되었습니까?

해결책

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

there are couple of good references:

다른 팁

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top