private void localizeOneResource(String fqfn, URI srcUri, ResourceType rt, FnResources result)
      throws URISyntaxException, IOException {
    RefCountedResource rcr = localFiles.get(srcUri);
    if (rcr != null && rcr.refCount > 0) {
      logFilesUsed("Reusing", fqfn, srcUri, rcr);
      ++rcr.refCount;
      result.addResources(rcr);
      return;
    }
    rcr = new RefCountedResource();
    List<URI> localUris = resourceDownloader.downloadExternal(srcUri, fqfn);
    if (localUris == null || localUris.isEmpty()) {
      LOG.error("Cannot download " + srcUri + " for " + fqfn);
      return;
    }
    rcr.resources = new ArrayList<>();
    for (URI uri : localUris) {
      // Reuse the same type for all. Only Ivy can return more than one, probably all jars.
      String path = uri.getPath();
      rcr.resources.add(new FunctionResource(rt, path));
      if (rt == ResourceType.JAR) {
        recentlyLocalizedJars.add(path);
      }
    }
    ++rcr.refCount;
    logFilesUsed("Using", fqfn, srcUri, rcr);
    localFiles.put(srcUri, rcr);
    result.addResources(rcr);
  }
This class localizes and manages jars for the functions allowed inside LLAP.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/FunctionLocalizer.java