1 15 package org.apache.hivemind.service.impl; 16 17 import java.util.ArrayList ; 18 import java.util.List ; 19 20 26 class ClassFactoryClassLoader extends ClassLoader 27 { 28 private List _loaders = new ArrayList (); 29 30 public ClassFactoryClassLoader(ClassLoader parent) 31 { 32 super(parent); 33 } 34 35 38 public synchronized void addDelegateLoader(ClassLoader loader) 39 { 40 _loaders.add(loader); 41 } 42 43 46 protected synchronized Class findClass(String name) throws ClassNotFoundException 47 { 48 int count = _loaders.size(); 49 for (int i = 0; i < count; i++) 50 { 51 ClassLoader l = (ClassLoader ) _loaders.get(i); 52 53 try 54 { 55 return l.loadClass(name); 56 } 57 catch (ClassNotFoundException ex) 58 { 59 } 61 } 62 63 throw new ClassNotFoundException (name); 64 }} | Popular Tags |