Are you sure you don't mean
Iterator it = loaders.iterator(); while (it.hasNext()) { ClassLoader cl = (ClassLoader)it.next(); if (cl != skipLoader) { try { clazz = cl.loadClass(className); return clazz; } catch (ClassNotFoundException ignored) { // go on and try the next loader } } } throw new ClassNotFoundException(className); } at the end of loadClassWithout? The original version looks through all classloaders and you get the last version that loads, rather than stopping when you find one working version. ??? thanks david jencks On 2001.12.02 21:13:31 -0500 Juha Lindfors wrote: > User: juhalindfors > Date: 01/12/02 18:13:31 > > Added: src/main/org/jboss/mx/loading BasicLoaderRepository.java > LoaderRepository.java > Log: > build fancy loaders here > > Revision Changes Path > 1.1 jmx/src/main/org/jboss/mx/loading/BasicLoaderRepository.java > > Index: BasicLoaderRepository.java > =================================================================== > /* > * LGPL > */ > package org.jboss.mx.loading; > > import java.util.Set; > import java.util.Iterator; > import java.util.HashSet; > > public class BasicLoaderRepository implements LoaderRepository { > > private static LoaderRepository instance = null; > > public synchronized static LoaderRepository getInstance() { > if (instance != null) > return instance; > else { > instance = new BasicLoaderRepository(); > return instance; > } > } > > > protected Set loaders = new HashSet(); > > private BasicLoaderRepository() { > > > } > > public Class loadClass(String className) throws > ClassNotFoundException { > return loadClassWithout(null, className); > } > > public Class loadClassWithout(ClassLoader skipLoader, String > className) throws ClassNotFoundException { > > Class clazz = null; > > // try ctx cl first > ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); > > if (ctxLoader != skipLoader) { > try { > clazz = ctxLoader.loadClass(className); > } > catch (ClassNotFoundException e) { > // ignore and move on to the loader list > } > } > > if (clazz != null) > return clazz; > > Iterator it = loaders.iterator(); > while (it.hasNext()) { > ClassLoader cl = (ClassLoader)it.next(); > > if (cl != skipLoader) { > try { > clazz = cl.loadClass(className); > } > catch (ClassNotFoundException ignored) { > // go on and try the next loader > } > } > } > > if (clazz == null) > throw new ClassNotFoundException(className); > > return clazz; > } > > public void addClassLoader(ClassLoader cl) { > loaders.add(cl); > } > > public void removeClassLoader(ClassLoader cl) { > loaders.remove(cl); > } > > > } > > > > 1.1 jmx/src/main/org/jboss/mx/loading/LoaderRepository.java > > Index: LoaderRepository.java > =================================================================== > /* > * LGPL > */ > package org.jboss.mx.loading; > > public interface LoaderRepository { > > public Class loadClass(String className) throws > ClassNotFoundException; > public Class loadClassWithout(ClassLoader loader, String className) > throws ClassNotFoundException; > public void addClassLoader(ClassLoader cl); > public void removeClassLoader(ClassLoader cl); > > } > > > > > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development