/** A subset of the functionality found in getResource(String, ClassLoader), * but this version queries the parentRepository and does not use the scl * to avoid leaking class loaders across scoped. * * @param name - the resource name * @param scl - the requesting class loader * @return the resource URL if found, null otherwise */ private URL getParentResource(String name, ClassLoader scl) { // Not found in classloader, ask the global cache URL resource = parentRepository.getResourceFromGlobalCache(name); // The cache has it, we are done if( resource != null ) return resource; // Not visible in global cache, iterate on all classloaders resource = parentRepository.getResourceFromRepository(name, scl); return resource; }
/** A subset of the functionality found in getResource(String, ClassLoader), * but this version queries the parentRepository and does not use the scl * to avoid leaking class loaders across scoped. * * @param name - the resource name * @param scl - the requesting class loader * @return the resource URL if found, null otherwise */ private URL getParentResource(String name, ClassLoader scl) { // Not found in classloader, ask the global cache URL resource = parentRepository.getResourceFromGlobalCache(name); // The cache has it, we are done if( resource != null ) return resource; // Not visible in global cache, iterate on all classloaders resource = parentRepository.getResourceFromRepository(name, scl); return resource; }
/** * Loads a resource following the Unified ClassLoader architecture */ public URL getResource(String name, ClassLoader cl) { // getResource() calls are not synchronized on the classloader from JDK code. // First ask the cache (of the calling classloader) URL resource = getResourceFromCache(name, cl); // The resource was already loaded by the calling classloader, we're done if (resource != null) return resource; // Not found in cache, ask the calling classloader resource = getResourceFromClassLoader(name, cl); // The calling classloader sees the resource, we're done if (resource != null) return resource; // Not found in classloader, ask the global cache resource = getResourceFromGlobalCache(name); // The cache has it, we are done if (resource != null) return resource; // Not visible in global cache, iterate on all classloaders resource = getResourceFromRepository(name, cl); // Some other classloader sees the resource, we're done if (resource != null) return resource; // This resource is not visible return null; }
/** * Loads a resource following the Unified ClassLoader architecture */ public URL getResource(String name, ClassLoader cl) { // getResource() calls are not synchronized on the classloader from JDK code. // First ask the cache (of the calling classloader) URL resource = getResourceFromCache(name, cl); // The resource was already loaded by the calling classloader, we're done if (resource != null) return resource; // Not found in cache, ask the calling classloader resource = getResourceFromClassLoader(name, cl); // The calling classloader sees the resource, we're done if (resource != null) return resource; // Not found in classloader, ask the global cache resource = getResourceFromGlobalCache(name); // The cache has it, we are done if (resource != null) return resource; // Not visible in global cache, iterate on all classloaders resource = getResourceFromRepository(name, cl); // Some other classloader sees the resource, we're done if (resource != null) return resource; // This resource is not visible return null; }