1 7 8 package com.sun.jmx.remote.util; 9 10 import javax.management.loading.ClassLoaderRepository ; 11 12 public class ClassLoaderWithRepository extends ClassLoader { 13 public ClassLoaderWithRepository(ClassLoaderRepository clr, 14 ClassLoader cl2) { 15 16 if (clr == null) throw new 17 IllegalArgumentException ("Null ClassLoaderRepository object."); 18 19 repository = clr; 20 this.cl2 = cl2; 21 } 22 23 protected Class findClass(String name) throws ClassNotFoundException { 24 try { 25 return repository.loadClass(name); 26 } catch (ClassNotFoundException cne) { 27 if (cl2 != null) { 28 return cl2.loadClass(name); 29 } else { 30 throw cne; 31 } 32 } 33 } 34 35 private ClassLoaderRepository repository; 36 private ClassLoader cl2; 37 } 38 | Popular Tags |