private ClassLoader lookupLoader(final URL[] urls,final ClassLoader parent){
  if (urls == null) {
    return parent;
  }
synchronized (loaderTable) {
    Object ref;
    while ((ref=refQueue.poll()) != null) {
      if (ref instanceof LoaderKey) {
        LoaderKey key=(LoaderKey)ref;
        loaderTable.remove(key);
      }
 else       if (ref instanceof LoaderEntry) {
        LoaderEntry entry=(LoaderEntry)ref;
        if (!entry.removed) {
          loaderTable.remove(entry.key);
        }
      }
    }
    LoaderKey key=new LoaderKey(urls,parent);
    LoaderEntry entry=(LoaderEntry)loaderTable.get(key);
    ClassLoader loader;
    if (entry == null || (loader=(ClassLoader)entry.get()) == null) {
      if (entry != null) {
        loaderTable.remove(key);
        entry.removed=true;
      }
      loader=findOriginLoader(urls,parent);
      if (loader == null) {
        loader=createClassLoader(urls,parent,requireDlPerm);
      }
      entry=new LoaderEntry(key,loader);
      loaderTable.put(key,entry);
    }
    return loader;
  }
}

private ClassLoader lookupLoader ( final URL [ ] urls , final ClassLoader parent ) { if ( urls == null ) { return parent ; } synchronized ( loaderTable ) { Object ref ; while ( ( ref = refQueue . poll ( ) ) != null ) { if ( ref instanceof LoaderKey ) { LoaderKey key = ( LoaderKey ) ref ; loaderTable . remove ( key ) ; } else if ( ref instanceof LoaderEntry ) { LoaderEntry entry = ( LoaderEntry ) ref ; if ( ! entry . removed ) { loaderTable . remove ( entry . key ) ; } } } LoaderKey key = new LoaderKey ( urls , parent ) ; LoaderEntry entry = ( LoaderEntry ) loaderTable . get ( key ) ; ClassLoader loader ; if ( entry == null || ( loader = ( ClassLoader ) entry . get ( ) ) == null ) { if ( entry != null ) { loaderTable . remove ( key ) ; entry . removed = true ; } loader = findOriginLoader ( urls , parent ) ; if ( loader == null ) { loader = createClassLoader ( urls , parent , requireDlPerm ) ; } entry = new LoaderEntry ( key , loader ) ; loaderTable . put ( key , entry ) ; } return loader ; } }
look up the class loader for the given codebase url path and the given parent class loader . a new class loader instance will be created and returned if no match is found .
