class BlockingClassLoader extends URLClassLoader {

  @Override public URL getResource(String name) {

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

      if (m_respectGrandparents) {
        // We always have a grandparent classloader.
        final URL grandParentResult = getParent().getParent().getResource(name);

        if (grandParentResult != null) {
          return grandParentResult;
        }
      }

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

      if (m_isolated.matches(name, true)) {
        return findResource(name);
      }
    }

    return super.getResource(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);

}