assertEquals(1, stats.loadClass);
}
public void testClearClassCache() throws Exception
{
AbstractClassLoadingDomain domain = new AbstractClassLoadingDomain();
SimpleClassLoader scl = new SimpleClassLoader();
scl.addClass("xyzzy.Hello", String.class);
DelegatingDomainClassLoader ddcl = new DelegatingDomainClassLoader(scl);
domain.addDomainClassLoader(ddcl);
domain.loadClass("xyzzy.Hello", false, null);
ClassLoaderStats stats = (ClassLoaderStats) scl.requests.get("xyzzy.Hello");
assertNotNull(stats);
assertEquals(1, stats.loadClass);
domain.removeDomainClassLoader(ddcl);
try
{
domain.loadClass("xyzzy.Hello", false, null);
fail("Should not be here!");
}
catch (ClassNotFoundException expected)
{
}
domain.addDomainClassLoader(ddcl);
domain.loadClass("xyzzy.Hello", false, null);
assertEquals(2, stats.loadClass);
}