Description
The build.xml files of my subprojects include Ant's <taskdef/> element to define Ivy tasks. This element causes creation of a new classloader to load the Ivy jars.
The code from IvyContext.java:
public class IvyContext {
private static ThreadLocal/<Stack<IvyContext>>/ current = new ThreadLocal();
...
}
This static initialization runs once with every classloader and creates a new ThreadLocal object every time. All those ThreadLocal objects are visible (referenced) from the main Thread. For 12 subprojects I end up with 12 ThreadLocal objects each containing one Stack holding IvyContext objects. The IvyContext objects point to its class which points to its ClassLoader. The 12 ClassLoaders stay retained.