class BlockingClassLoader extends URLClassLoader {

  @Override
  public Enumeration<URL> getResources(String name) throws IOException {

    if (!m_shared.matches(name, true)) {

      final List<URL> result = new ArrayList<URL>();

      if (m_respectGrandparents) {
        // We always have a grandparent classloader.
        result.addAll(list(getParent().getParent().getResources(name)));
      }

      if (m_blocked.matches(name, true)) {
        return enumeration(result);
      }

      if (m_isolated.matches(name, true)) {
        result.addAll(list(findResources(name)));

        return enumeration(result);
      }
    }

    return super.getResources(name);
  }

  public  BlockingClassLoader(URLClassLoader parent,
                             List<URL> additionalClassPath,
                             Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents);
  public  BlockingClassLoader(List<URL> additionalClassPath,
                             Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents);
  public  BlockingClassLoader(Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents);

}