code: private static Object findJarServiceProvider(String factoryId) throws ConfigurationError {
          String serviceId = "META-INF/services/" + factoryId;
          InputStream is = null;
  
          // First try the Context ClassLoader
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
          if (cl != null) {
              is = cl.getResourceAsStream(serviceId);
          }
  
          if (is == null) {
              cl = FactoryFinder.class.getClassLoader();
              is = cl.getResourceAsStream(serviceId);
          }
  
          if (is == null) {
              // No provider found
              return null;
          }
  
          if (debug) debugPrintln("found jar resource=" + serviceId + " using ClassLoader: " + cl);
  
          BufferedReader rd;
          try {
              rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
          } catch (java.io.UnsupportedEncodingException e) {
              rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
          }
  
          String factoryClassName = null;
          try {
              // XXX Does not handle all possible input as specified by the
              // Jar Service Provider specification
              factoryClassName = rd.readLine();
          } catch (IOException x) {
              // No provider found
              return null;
          } finally {
              IoUtils.closeQuietly(rd);
          }
  
          if (factoryClassName != null &&
              ! "".equals(factoryClassName)) {
              if (debug) debugPrintln("found in resource, value="
                     + factoryClassName);
  
              return newInstance(factoryClassName, cl);
          }
  
          // No provider found
          return null;
      }
docs: /*
  Try to find provider using Jar Service Provider Mechanism
  
  @return instance of provider class if found or null