I Have a singleton class which is in 2 different jars. I've both jars in my class path. Now my application is running inside a JVM. I want to get instances of both the singletons. How can we achieve this in java? Is it possible using class loaders?
Asked
Active
Viewed 42 times
0
-
Do both classes have the same absolute name? – TheLostMind Feb 17 '16 at 10:09
-
Ae they in different packages? If yes, specify the full package name when using them. – Frank Puffer Feb 17 '16 at 10:09
-
1a so called doppelganger singleton – wero Feb 17 '16 at 10:10
-
1Then use [UrlClassLoader](https://docs.oracle.com/javase/7/docs/api/java/net/URLClassLoader.html) – TheLostMind Feb 17 '16 at 10:10
-
@FrankPuffer: Both classes are in same package name. Just logic used in methods are different. Rest is exactly same. – Arjuna Arjun Feb 17 '16 at 10:12