コード例 #1
0
ファイル: PomClassLoader.java プロジェクト: TradeLine/TWT
 @Override
 public Enumeration<URL> getResources(String name) throws IOException {
   final HashSet<URL> urls = new HashSet<>();
   for (ClassLoader cl : parents) {
     urls.addAll(Collections.list(cl.getResources(name)));
   }
   urls.addAll(Collections.list(super.getResources(name)));
   urls.addAll(Collections.list(getSystemClassLoader().getResources(name)));
   return Collections.enumeration(urls);
 }
コード例 #2
0
ファイル: PomClassLoader.java プロジェクト: TradeLine/TWT
  @Override
  public Class<?> loadClass(String name) throws ClassNotFoundException {
    name = name.trim();
    try {
      return Thread.currentThread().getContextClassLoader().loadClass(name);
    } catch (ClassNotFoundException e) {

    }
    try {
      Class cl = super.loadClass(name);
      LOG.info("---loaded " + name + " from " + this.name);
      return cl;
    } catch (ClassNotFoundException e) {
      LOG.info("---Class " + name + " not found in " + this.name);
    }
    for (ClassLoader cl : parents) {
      try {
        return cl.loadClass(name);
      } catch (ClassNotFoundException e) {
        //
      }
    }
    return getSystemClassLoader().loadClass(name);
  }