private static void registerServiceClass(final Class<?> type,final Map<String,ClassLoader> classloaderMap,final ClassLoader classLoader,final Set<Class> classes){
  final String className=type.getName();
  final ClassLoader registeredClassLoader=classloaderMap.get(className);
  if (registeredClassLoader == null) {
    classloaderMap.put(className,classLoader);
    classes.add(type);
  }
 else {
    boolean loadedFromAncestor=false;
    ClassLoader ancestorClassLoader=classLoader.getParent();
    while (ancestorClassLoader != null) {
      if (ancestorClassLoader == registeredClassLoader) {
        loadedFromAncestor=true;
        break;
      }
      ancestorClassLoader=ancestorClassLoader.getParent();
    }
    if (!loadedFromAncestor) {
      logger.warn("Attempt was made to load " + className + " from "+ classLoader+ " but that class name is already loaded/registered from "+ registeredClassLoader+ ".  This may cause unpredictable behavior.  Order of NARs is not guaranteed.");
    }
  }
}

private static void registerServiceClass ( final Class < ? > type , final Map < String , ClassLoader > classloaderMap , final ClassLoader classLoader , final Set < Class > classes ) { final String className = type . getName ( ) ; final ClassLoader registeredClassLoader = classloaderMap . get ( className ) ; if ( registeredClassLoader == null ) { classloaderMap . put ( className , classLoader ) ; classes . add ( type ) ; } else { boolean loadedFromAncestor = false ; ClassLoader ancestorClassLoader = classLoader . getParent ( ) ; while ( ancestorClassLoader != null ) { if ( ancestorClassLoader == registeredClassLoader ) { loadedFromAncestor = true ; break ; } ancestorClassLoader = ancestorClassLoader . getParent ( ) ; } if ( ! loadedFromAncestor ) { logger . warn ( "Attempt was made to load " + className + " from " + classLoader + " but that class name is already loaded/registered from " + registeredClassLoader + ".  This may cause unpredictable behavior.  Order of NARs is not guaranteed." ) ; } } }
registers extension for the specified type from the specified classloader .
