diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java index e3e6d81fa4..c1e15dfff3 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java @@ -52,8 +52,9 @@ import org.jboss.logging.Logger; public class ClassLoaderServiceImpl implements ClassLoaderService { private static final Logger log = Logger.getLogger( ClassLoaderServiceImpl.class ); - private final ClassLoader aggregatedClassLoader; - private final LinkedList loaders = new LinkedList(); + private final AggregatedClassLoader aggregatedClassLoader; + + private final LinkedList serviceLoaders = new LinkedList(); /** * Constructs a ClassLoaderServiceImpl with standard set-up @@ -320,21 +321,21 @@ public class ClassLoaderServiceImpl implements ClassLoaderService { @Override public LinkedHashSet loadJavaServices(Class serviceContract) { - ServiceLoader serviceLoader = ServiceLoader.load( serviceContract, aggregatedClassLoader ); - final LinkedHashSet services = new LinkedHashSet(); - for ( S service : serviceLoader) { + ServiceLoader serviceLoader = ServiceLoader.load( serviceContract, aggregatedClassLoader ); + final LinkedHashSet services = new LinkedHashSet(); + for ( S service : serviceLoader ) { services.add( service ); } - loaders.add(serviceLoader); + serviceLoaders.add( serviceLoader ); return services; } @Override public void stop() { - while (!loaders.isEmpty()){ - ServiceLoader loader = loaders.removeLast(); - loader.reload();//clear service loader providers - } + while ( !serviceLoaders.isEmpty() ) { + ServiceLoader loader = serviceLoaders.removeLast(); + loader.reload(); // clear service loader providers + } } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!