アノテーションが定義されたClassLoaderとJavaBeansを定義したClassLoaderを設定する。
@param classLoader アノテーションを見つけるために使用するClassLoader
@param propertyLoaders JavaBeansを見つけるために使用するClassLoader
558661
public static void init(final ClassLoader classLoader, final ClassLoader[] propertyLoaders) {
        getInstance().classLoader = classLoader;
        
        if(propertyLoaders != null && propertyLoaders.length != 0) {
            Map<Integer, ClassLoader> loaderMap = new HashMap<>();
            for(ClassLoader propertyLoader : propertyLoaders) {
                loaderMap.put(propertyLoader.hashCode(), propertyLoader);
            }
            
            getInstance().ognlContext = new OgnlContext(loaderMap);
            getInstance().ognlContext.setMemberAccess(new DefaultMemberAccess(true));
            getInstance().ognlContext.setClassResolver(new MultipleLoaderClassResolver());
            
        }
    }
738649
public static Config load(final ClassLoader loader) {
        final ConfigParseOptions withLoader = ConfigParseOptions.defaults().setClassLoader(loader);
        return ConfigImpl.computeCachedConfig(loader, "load", new Callable<Config>() {
            @Override
            public Config call() {
                return load(loader, defaultApplication(withLoader));
            }
        });
    }
27999
public final void addSubLoader(AbstractClassLoader loader) {
		if (subLoaders == null) subLoaders = new ArrayList<>();
		subLoaders.add(loader);
	}
105675
public static EnvironmentClassLoader
    getEnvironmentClassLoader(ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader)
        return (EnvironmentClassLoader) loader;
    }

    return null;
  }
885175
@SuppressWarnings({"rawtypes", "unchecked"})
	private static void loadAnnotationHandlers(HandlerLibrary lib, Trees trees) throws IOException {
		//No, that seemingly superfluous reference to JavacAnnotationHandler's classloader is not in fact superfluous!
		for (JavacAnnotationHandler handler : SpiLoadUtil.findServices(JavacAnnotationHandler.class, JavacAnnotationHandler.class.getClassLoader())) {
			handler.setTrees(trees);
			Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler();
			AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
			String annotationClassName = container.annotationClass.getName().replace("$", ".");
			List<AnnotationHandlerContainer<?>> list = lib.annotationHandlers.get(annotationClassName);
			if (list == null) lib.annotationHandlers.put(annotationClassName, list = new ArrayList<AnnotationHandlerContainer<?>>(1));
			list.add(container);
			lib.typeLibrary.addType(container.annotationClass.getName());
		}
	}
841595
public static PropertyFile[] findAll(ClassLoader loader, final String name)
	{
		try
		{
			final Enumeration<URL> urls = loader.getResources(name);

			List<PropertyFile> files = new ArrayList<PropertyFile>();

			for (URL url : ListUtility.iterate(urls))
			{
				InputStream is = null;
				try
				{
					is = url.openStream();
					final PropertyFile file = new PropertyFile(is);

					files.add(file);
				}
				catch (IOException e)
				{
					throw new RuntimeException("Error loading properties from " +
					                           url +
					                           " for name: " +
					                           name +
					                           ": " +
					                           e.getMessage(), e);
				}
				finally
				{
					IOUtils.closeQuietly(is);
				}
			}

			return files.toArray(new PropertyFile[files.size()]);
		}
		catch (IOException e)
		{
			throw new RuntimeException("Error loading properties for name: " + name + ": " + e.getMessage(), e);
		}
	}
170357
public static PropertyFile find(final ClassLoader classloader, final String... fileNames)
	{
		URL resolvedResource = null;
		String resolvedFile = null;

		for (String fileName : fileNames)
		{
			if (fileName.charAt(0) == '/')
			{
				File file = new File(fileName);

				if (file.exists())
				{
					try
					{
						return PropertyFile.readOnly(file);
					}
					catch (IOException e)
					{
						throw new IllegalArgumentException("Error loading property file: " +
						                                   fileName +
						                                   ". Error: " +
						                                   e.getMessage(), e);
					}
				}
			}
			else
			{
				// Try to resolve the filename (for logging any errors)
				final URL resource = classloader.getResource(fileName);

				if (resource != null)
				{
					resolvedFile = fileName;
					resolvedResource = resource;
					break;
				}
			}
		}

		if (resolvedFile == null)
		{
			if (fileNames.length == 1)
				throw new IllegalArgumentException("Error finding property file in classpath: " + fileNames[0]);
			else
				throw new IllegalArgumentException("Error finding property files in classpath: " + Arrays.asList(fileNames));
		}
		else if (log.isInfoEnabled())
			log.info("{find} Loading properties from " + resolvedFile);

		return openResource(classloader, resolvedResource, resolvedFile);
	}
875203
public static void preload(@NonNull ClassLoader classLoader) {
      Resource r = new ClasspathResource("META-INF/preload.classes", classLoader);
      if (r.exists()) {
         try {
            r.readLines().forEach(ReflectionUtils::getClassForNameQuietly);
         } catch (IOException e) {
            e.printStackTrace();
         }
      }
   }
1044245
@Override
  public ClassLoader getClassLoader() {
    URL[] urlsForClassLoader = new URL[urls.size()];
    urls.toArray(urlsForClassLoader);

    URLClassLoader classLoader = new URLClassLoader(urlsForClassLoader);
    Thread.currentThread().setContextClassLoader(classLoader);

    return classLoader;
  }
556081
private synchronized void removeLoader(ClassLoader loader)
  {
    int i;
    for (i = _loaders.size() - 1; i >= 0; i--) {
      WeakReference<ClassLoader> ref = _loaders.get(i);
      ClassLoader refLoader = ref.get();

      if (refLoader == null)
        _loaders.remove(i);
      else if (refLoader == loader)
        _loaders.remove(i);
    }
  }
1119685
public void pushClassLoader(BeanMetaData bmd)
    {
        ClassLoader classLoader = bmd.ivContextClassLoader; // F85059
        Object origCL = svThreadContextAccessor.pushContextClassLoaderForUnprivileged(classLoader);
        ivClassLoaderStack.push(origCL);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "pushClassLoader: " +
                         (origCL == ThreadContextAccessor.UNCHANGED ?
                                         "already " + Util.identity(classLoader) :
                                         Util.identity(origCL) + " -> " + Util.identity(classLoader)));
    }
41656
@Override
    public ClassLoader getClassLoader() {
        ClassLoader classLoader = this.initialClass.getClassLoader();
        if (classLoader == null) {
            classLoader = application.getClassLoader();
        }
        return classLoader;
    }
292111
public void addLocalClassPath(ClassLoader loader)
  {
    String classpath = null;

    if (loader instanceof DynamicClassLoader)
      classpath = ((DynamicClassLoader) loader).getLocalClassPath();
    else
      classpath = System.getProperty("java.class.path");

    addClassPath(classpath);
  }
868295
public void setClassLoader(GroovyClassLoader loader) {
        ClassLoader parent = Thread.currentThread().getContextClassLoader();
        if (parent == null) parent = ProcessingUnit.class.getClassLoader();
        this.classLoader = (loader == null ? new GroovyClassLoader(parent, configuration) : loader);
    }
360411
public void classLoaderDestroy(DynamicClassLoader loader)
  {
    Object resource = _resourceRef.get();
    if (resource == null)
      return;
    
    Method destroy = CloseListener.getDestroyMethod(resource.getClass());

    if (destroy == null)
      return;
    
    try {
      destroy.invoke(resource, (Object []) null);
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
    }
  }
833974
public static void setPreferredClassLoader(ClassLoader classLoader) {
		if (classLoader != dynamicLoader) {
			dynamicLoader = classLoader;
			final Thread[] threads = new Thread[Thread.activeCount()];
			Thread.enumerate(threads);
			for (final Thread t : threads) {
				if (t != null) {
					t.setContextClassLoader(classLoader);
				}
			}
		}
	}
996264
public static ProxyClassLoader convertClassloader(ClassLoader loader) {
        if (loader == null) {
            return ProxyClient.DEFAULT_LOADER;
        } else if (loader instanceof ProxyClassLoader) {
            return (ProxyClassLoader) loader;
        } else {
            return new ProxyClassLoader(loader);
        }
    }