Protected class<!--?--> LoadClass (String name, Boolean resolve) throws classnotfoundexception{//plus lock, synchronous processing because it can be Can be multithreaded in the Load class synchronized (Getclassloadinglock (name)) {//check if the class has already been loaded, and if loaded, the class C is not loaded = Findloadedclass (name); if (c = = null) {Long T0 = System.nanotime (); try {//If the parent of the custom class loader is not NULL, the loadclass of the parent is called to load the class if (parent! = NULL) { c = Parent.loadclass (name, false); } else {///If the parent of the custom ClassLoader is null, call the Findbootstrapclass method to find the class, which is the Bootstrap class loader c = findbootstrapclassornull (name); }} catch (ClassNotFoundException e) {//ClassNotFoundException thrown if class not F Ound//From the Non-null parent class loader} if (c = = null) { // If still not found, then invoke Findclass in order//to find the class. Long T1 = System.nanotime (); If the parent load class fails, it calls its own Findclass method to load Class C = Findclass (name); This is the defining class loader; Record the stats sun.misc.PerfCounter.getParentDelegationTime (). Addtime (T1-T0); Sun.misc.PerfCounter.getFindClassTime (). Addelapsedtimefrom (t1); Sun.misc.PerfCounter.getFindClasses (). increment (); }} if (resolve) {resolveclass (c); } return C; } }
1 protectedclass<!--?--> LoadClass (String name,BooleanResolvethrowsclassnotfoundexception{2 //plus lock, synchronous processing, because it may be multithreaded in the load class3 synchronized(Getclassloadinglock (name)) {4 //Check to see if the class has already been loaded, and if it has been loaded, it will not load the5Class C =Findloadedclass (name);6 if(c = =NULL) {7 LongT0 =system.nanotime ();8 Try {9 //if the parent of the custom class loader is not NULL, the loadclass of the parent is called to load the classTen if(Parent! =NULL) { Onec = Parent.loadclass (name,false); A}Else { - //if the parent of the custom ClassLoader is null, call the Findbootstrapclass method to find the class, which is the Bootstrap class loader -c =findbootstrapclassornull (name); the } -}Catch(ClassNotFoundException e) { - //ClassNotFoundException thrown if class not found - //From the Non-null parent class loader + } - + if(c = =NULL) { A //If still not found, then invoke Findclass in order at //To find the class. - LongT1 =system.nanotime (); - //if the parent load class fails, it calls its own Findclass method for class loading -c =Findclass (name); - - //This is the defining class loader; record the stats inSun.misc.PerfCounter.getParentDelegationTime (). Addtime (T1-t0); - sun.misc.PerfCounter.getFindClassTime (). Addelapsedtimefrom (t1); to sun.misc.PerfCounter.getFindClasses (). increment (); + } - } the if(resolve) { * Resolveclass (c); $ }Panax Notoginseng returnC; - } the}View Code
Java High Salary Road __001_ class