diff --git a/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceImpl.java b/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceImpl.java index 90b06c6f8f..b35dc0b1fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/classloading/internal/ClassLoaderServiceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/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; @@ -272,7 +271,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 7a090db958..e1dc63f075 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; @@ -45,8 +45,8 @@ import org.osgi.framework.Bundle; public class OsgiClassLoader extends ClassLoader { // 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>();