private void foundAvailablePlugins() {
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    ServiceLoader<T> buildInLoader = ServiceLoader.load(pluginType, classLoader);
    addToFoundedPlugin(buildInLoader);

    try {
      Path pluginPath = Paths.get(pluginPath());
      if (!Files.exists(pluginPath) || !Files.isDirectory(pluginPath)) {
        return;
      }
      Files.list(pluginPath)
          .map(Path::toFile)
          .forEach(
              file -> {
                if (file.isFile() && file.getName().endsWith(".jar")) {
                  findSingleJarExternalPlugins(file, classLoader);
                } else if (file.isDirectory()) {
                  findClasspathExternalPlugins(file, classLoader);
                }
              });
    } catch (IOException e) {
      throw new LoadingPluginException("Failed when discover available plugins", e);
    }
  }
Visit all installed plugins.

@param visitor function to visit all installed plugins.
amoro-ams/src/main/java/org/apache/amoro/server/manager/AbstractPluginManager.java