public static <T> Collection<T> load(Class<T> contract, ClassLoader... loaders) {
      Map<String, T> services = new LinkedHashMap<>();

      if (loaders.length == 0) {
         try {
            ServiceLoader<T> loadedServices = ServiceLoader.load(contract);
            addServices(loadedServices, services);
         } catch (Exception e) {
            // Ignore
         }
      }
      else {
         for (ClassLoader loader : loaders) {
            if (loader == null)
               throw new NullPointerException();
            try {
               ServiceLoader<T> loadedServices = ServiceLoader.load(contract, loader);
               addServices(loadedServices, services);
            } catch (Exception e) {
               // Ignore
            }
         }
      }

      if (services.isEmpty()) {
         LOG.debugf("No service impls found: %s", contract.getSimpleName());
      }
      return services.values();
   }
@Test
   public void testDuplicateServiceFinder() {
      ClassLoader mainClassLoader = this.getClass().getClassLoader();
      ClassLoader otherClassLoader = new ClonedClassLoader(mainClassLoader);
      Collection<SampleSPI> spis = ServiceFinder.load(SampleSPI.class, mainClassLoader, otherClassLoader);
      assertEquals(1, spis.size());
   }