Java High Salary Road __001_ class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.