您的位置:首页 > 其它

循环、迭代、遍历和递归

2012-07-24 14:18 357 查看
 

Java Classloader Hierarchy

Classloaders contain a hierarchy with parent classloaders and child
classloaders. The relationship between parent and child classloaders is
analogous to the object relationship of super classes and subclasses.
The bootstrap classloader is the root of the Java classloader hierarchy.
The Java virtual machine (JVM) creates the bootstrap classloader, which
loads the Java development kit (JDK) internal classes and java.*
packages included in the JVM. (For example, the bootstrap classloader
loads java.lang.String.)
 

The extensions classloader is a child of the bootstrap classloader. The
extensions classloader loads any JAR files placed in the extensions
directory of the JDK. This is a convenient means to extending the JDK
without adding entries to the classpath. However, anything in the
extensions directory must be self-contained and can only refer to
classes in the extensions directory or JDK classes.
 

The system classpath classloader extends the JDK extensions classloader.
The system classpath classloader loads the classes from the classpath
of the JVM. Application-specific classloaders (including WebLogic Server
classloaders) are children of the system classpath classloader. 
 

Loading a Class

Classloaders use a delegation model when loading a class. The
classloader implementation first checks its cache to see if the
requested class has already been loaded. This class verification
improves performance in that its cached memory copy is used instead of
repeated loading of a class from disk. If the class is not found in its
cache, the current classloader asks its parent for the class. Only if
the parent cannot load the class does the classloader attempt to load
the class. If a class exists in both the parent and child classloaders,
the parent version is loaded. This delegation model is followed to avoid
multiple copies of the same form being loaded. Multiple copies of the
same class can lead to a ClassCastException.

Classloaders ask their parent classloader to load a class before attempting to load the class themselves.

 
from: http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/classloading.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: