i) it doesn't differentiate what is loaded before or after the load fromthe target domain
ii) it complicates the flushing in the event that the parent domain gets
flushed, e.g. a classloader is removed from the parent domain
Hmmm ... this code needs fixing then. ;-)
// Should we directly load from the parent?
if (findInParent == false)
{
Class<?> clazz = loadClassBefore(name);
if (clazz != null)
{
globalClassCache.put(path, new ClassCacheItem(clazz)); // REMOVE
return clazz;
}
}
We as a child don't know when a parent domain has a classloader removed
and therefore the cached result is invalid.
It could do if the parent domain flushed all the caches in its child domains, but it doesn't do that currently.
But even then the globalClassCache wouldn't differentiate the before/after rules.