/** * 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; }