//FIXME This needs revisiting/removing once the
ArrayList<AbstractClassPool> noAnnotationURLClassLoaderPools = null;
String resource = url.toString();
for(ClassPool pool : classPoolRepository.getRegisteredCLs().values())
{
AbstractClassPool candidate = (AbstractClassPool)pool;
if (candidate.isUnloadedClassLoader())
{
classPoolRepository.unregisterClassLoader(candidate.getClassLoader());
continue;
}
if (candidate.getClassLoader() instanceof RepositoryClassLoader)
{
//Sometimes the ClassLoader is a proxy for MBeanProxyExt?!
RepositoryClassLoader rcl = (RepositoryClassLoader)candidate.getClassLoader();
URL[] urls = rcl.getClasspath();
for (int i = 0 ; i < urls.length ; i++)
{
if (resource.indexOf(urls[i].getFile()) >= 0)
{
return candidate;
}
}
}
//FIXME Remove once we have the JBoss 5 version of pool
else if (isInstanceOfNoAnnotationURLClassLoader(candidate.getClassLoader()))
{
if (noAnnotationURLClassLoaderPools == null)
{
noAnnotationURLClassLoaderPools = new ArrayList<AbstractClassPool>();
}