File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 16
16
17
17
## 回顾一下类加载过程
18
18
19
- 类加载过程:** 加载->连接->初始化** 。连接过程又可分为三步: ** 验证->准备->解析** 。
19
+ 类加载过程:** 加载->连接->初始化** 。连接过程又可分为三步: ** 验证->准备->解析** 。
20
20
21
21
![ 类加载过程] ( https://my-blog-to-use.oss-cn-beijing.aliyuncs.com/2019-6/类加载过程.png )
22
22
@@ -30,7 +30,7 @@ JVM 中内置了三个重要的 ClassLoader,除了 BootstrapClassLoader 其他
30
30
31
31
1 . ** BootstrapClassLoader(启动类加载器)** :最顶层的加载类,由C++实现,负责加载 ` %JAVA_HOME%/lib ` 目录下的jar包和类或者或被 ` -Xbootclasspath ` 参数指定的路径中的所有类。
32
32
2 . ** ExtensionClassLoader(扩展类加载器)** :主要负责加载目录 ` %JRE_HOME%/lib/ext ` 目录下的jar包和类,或被 ` java.ext.dirs ` 系统变量所指定的路径下的jar包。
33
- 3 . ** AppClassLoader(应用程序类加载器)** : 面向我们用户的加载器,负责加载当前应用classpath下的所有jar包和类。
33
+ 3 . ** AppClassLoader(应用程序类加载器)** : 面向我们用户的加载器,负责加载当前应用classpath下的所有jar包和类。
34
34
35
35
## 双亲委派模型
36
36
@@ -60,7 +60,7 @@ The Parent of ClassLodarDemo's ClassLoader is sun.misc.Launcher$ExtClassLoader@1
60
60
The GrandParent of ClassLodarDemo's ClassLoader is null
61
61
```
62
62
63
- ` AppClassLoader ` 的父类加载器为` ExtClassLoader `
63
+ ` AppClassLoader ` 的父类加载器为` ExtClassLoader ` ,
64
64
` ExtClassLoader ` 的父类加载器为null,** null并不代表` ExtClassLoader ` 没有父类加载器,而是 ` BootstrapClassLoader ` ** 。
65
65
66
66
其实这个双亲翻译的容易让别人误解,我们一般理解的双亲都是父母,这里的双亲更多地表达的是“父母这一辈”的人而已,并不是说真的有一个 Mother ClassLoader 和一个 Father ClassLoader 。另外,类加载器之间的“父子”关系也不是通过继承来体现的,是由“优先级”来决定。官方API文档对这部分的描述如下:
You can’t perform that action at this time.
0 commit comments