code: private static synchronized Iterator providers(Class cls,ClassLoader cl) {
          String serviceFile = "META-INF/services/"+cls.getName();
  
          // System.out.println("File: " + serviceFile);
  
          Vector v = (Vector)providerMap.get(serviceFile);
          if (v != null)
              return v.iterator();
  
          v = new Vector();
          providerMap.put(serviceFile, v);
  
          Enumeration e;
          try {
              e = cl.getResources(serviceFile);
          } catch (IOException ioe) {
              return v.iterator();
          }
  
          while (e.hasMoreElements()) {
              try {
                  URL u = (URL)e.nextElement();
  //                System.out.println("URL: " + u);
  
                  InputStream    is = u.openStream();
                  Reader         r  = new InputStreamReader(is, "UTF-8");
                  BufferedReader br = new BufferedReader(r);
  
                  String line = br.readLine();
                  while (line != null) {
                      try {
                          // First strip any comment...
                          int idx = line.indexOf('#');
                          if (idx != -1)
                              line = line.substring(0, idx);
  
                          // Trim whitespace.
                          line = line.trim();
  
                          // If nothing left then loop around...
                          if (line.length() == 0) {
                              line = br.readLine();
                              continue;
                          }
                          // System.out.println("Line: " + line);
  
                          // Try and load the class 
                          Object obj = cl.loadClass(line).newInstance();
                          // stick it into our vector...
                          v.add(obj);
                      } catch (Exception ex) {
                          // Just try the next line
  //                        ex.printStackTrace();
                      }
                      line = br.readLine();
                  }
              } catch (Exception ex) {
                  // Just try the next file...
              }
          }
          return v.iterator();
      }
docs: /*
  version  Service.java,v 1.1 2001/04/27 19:55:44 deweese Exp