private void init(Path pathPattern, String pathPrefix, Configuration conf) throws IOException {
    // Copy the jar to the local filesystem
    String parentDirStr = conf.get(LOCAL_DIR_KEY, DEFAULT_LOCAL_DIR) + TMP_JARS_DIR;
    synchronized (parentDirLockSet) {
      if (!parentDirLockSet.contains(parentDirStr)) {
        Path parentDir = new Path(parentDirStr);
        FileSystem fs = FileSystem.getLocal(conf);
        fs.delete(parentDir, true); // it's ok if the dir doesn't exist now
        parentDirLockSet.add(parentDirStr);
        if (!fs.mkdirs(parentDir) && !fs.getFileStatus(parentDir).isDirectory()) {
          throw new RuntimeException("Failed to create local dir " + parentDirStr
            + ", CoprocessorClassLoader failed to init");
        }
      }
    }

    FileSystem fs = pathPattern.getFileSystem(conf);
    // append "*.jar" if a directory is specified
    Path pathPattern1 = fs.isDirectory(pathPattern) ? new Path(pathPattern, "*.jar") : pathPattern;
    // return all files that match the pattern
    FileStatus[] fileStatuses = fs.globStatus(pathPattern1);
    if (fileStatuses == null || fileStatuses.length == 0) {
      // if no one matches
      throw new FileNotFoundException(pathPattern1.toString());
    } else {
      boolean validFileEncountered = false;
      // for each file that match the pattern
      for (Path path : FileUtil.stat2Paths(fileStatuses)) {
        if (fs.isFile(path)) {
          // only process files, skip for directories
          File dst = new File(parentDirStr, "." + pathPrefix + "." + path.getName() + "."
            + EnvironmentEdgeManager.currentTime() + ".jar");
          fs.copyToLocalFile(path, new Path(dst.toString()));
          dst.deleteOnExit();

          addURL(dst.getCanonicalFile().toURI().toURL());

          JarFile jarFile = new JarFile(dst.toString());
          try {
            // get entries inside a jar file
            Enumeration<JarEntry> entries = jarFile.entries();
            while (entries.hasMoreElements()) {
              JarEntry entry = entries.nextElement();
              Matcher m = libJarPattern.matcher(entry.getName());
              if (m.matches()) {
                File file = new File(parentDirStr, "." + pathPrefix + "." + path.getName() + "."
                  + EnvironmentEdgeManager.currentTime() + "." + m.group(1));
                try (FileOutputStream outStream = new FileOutputStream(file)) {
                  IOUtils.copyBytes(jarFile.getInputStream(entry), outStream, conf, true);
                }
                file.deleteOnExit();
                addURL(file.toURI().toURL());
              }
            }
          } finally {
            jarFile.close();
          }
          // Set to true when encountering a file
          validFileEncountered = true;
        }
      }
      if (validFileEncountered == false) {
        // all items returned by globStatus() are directories
        throw new FileNotFoundException("No file found matching " + pathPattern1.toString());
      }
    }
  }
Creates a JarClassLoader that loads classes from the given paths.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java