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 df0a48d48d..050c2586fa 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 @@ -31,7 +31,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; @@ -43,7 +42,6 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoadingException; import org.hibernate.cfg.AvailableSettings; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.util.ClassLoaderHelper; - import org.jboss.logging.Logger; /** @@ -182,7 +180,7 @@ public class ClassLoaderServiceImpl implements ClassLoaderService { @Override public Enumeration getResources(String name) throws IOException { - final HashSet resourceUrls = new HashSet(); + final LinkedHashSet resourceUrls = new LinkedHashSet(); for ( ClassLoader classLoader : individualClassLoaders ) { final Enumeration urls = classLoader.getResources( name ); diff --git a/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiClassLoader.java b/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiClassLoader.java index 5f0d6a2ff7..cc7a672b73 100644 --- a/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiClassLoader.java +++ b/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiClassLoader.java @@ -27,7 +27,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; @@ -46,8 +46,8 @@ import org.osgi.framework.Bundle; public class OsgiClassLoader extends ClassLoader implements Stoppable { // Leave these as Sets -- addClassLoader or addBundle may be called more // than once if a SF or EMF is closed and re-created. - private Set classLoaders = new HashSet(); - private Set bundles = new HashSet(); + private Set classLoaders = new LinkedHashSet(); + private Set bundles = new LinkedHashSet(); private Map> classCache = new HashMap>(); private Map resourceCache = new HashMap();