关于“Inside the Java Virtual Machine - Chapter 8 - The Linking Model - Class Loaders and the Parent-Delegation Model”的疑问

JasonLaw:在Inside the Java Virtual Machine - Chapter 8 - The Linking Model - Class Loaders and the Parent-Delegation Model中,有如下这么一段:

In Java terminology, a class loader that is asked to load a type, but returns a type loaded by some other class loader, is called an initiating class loader of that type. The class loader that actually defines the type is called the defining class loader for the type. In the previous example, therefore, the defining class loader for java.io.FileReader is the bootstrap class loader. Class Cindy is an initiating class loader, but so are Mom, Grandma, and even the bootstrap class loader. Any class loader that is asked to load a type and is able to return a reference to the Class instance representing the type is an initiating loader of that type.

"a class loader that is asked to load a type, but returns a type loaded by some other class loader, is called an initiating class loader of that type"和"Any class loader that is asked to load a type and is able to return a reference to the Class instance representing the type is an initiating loader of that type"是不是有点矛盾?

假设 parent-delegation chain 是"L -> Lp -> bootstrap",应用请求 class loader L 加载 java.io.FileReader,L 会 delegate 给 Lp,Lp 会 delegate 给 bootstrap,bootstrap 会成功加载并返回 Class instance 给 Lp,然后 Lp 返回 Class instance 给 L 。

按照上面的例子,我理解的话,“a class loader that is asked to load a type, but returns a type loaded by some other class loader, is called an initiating class loader of that type”意味着“L 和 Lp 是 initiating class loader,而 bootstrap 不是,因为 type 就是被 bootstrap 加载的,不满足 returns a type loaded by some other class loader”。而“Any class loader that is asked to load a type and is able to return a reference to the Class instance representing the type is an initiating loader of that type”则意味着“L 、Lp 和 bootstrap 都是 initiating class loader”。这是书本的错误吗?

Chapter 5. Loading, Linking, and Initializing - 5.3. Creation and Loading也说了“When one class loader delegates to another class loader, the loader that initiates the loading is not necessarily the same loader that completes the loading and defines the class. If L creates C, either by defining it directly or by delegation, we say that L initiates loading of C or, equivalently, that L is an initiating loader of C.”。

Java-向Servlet动态添加URL模式 - java

是否可以在运行时动态地将URL模式添加到Servlet?例如,当Servlet启动时,扫描文件夹中的注释,然后将这些URL模式注入到Servlet中?提供更多清晰度-在Servlet的init文件中,我要执行此操作(伪代码)// scan all the files in the package my.project.services // find all…

执行shell命令时永久挂起(Java) - java

令人讨厌的代码块如下。该代码几乎总是可以工作,但有时会永远挂起。该应用程序是一个EJB计时器bean。实际上,它只挂了一次,我无法复制它。它的工作已经有将近两年没有任何问题。但是,在测试应用程序的更新版本时,计时器仅在运行几天后冻结,而从未从上次运行时释放数据库锁。日志清楚地表明它冻结在下面的代码块中的某个位置。它正在运行的命令是“ chmod”。publi…

如何检索字符串的特定部分 - java

我有一个目录以字符串形式列出,我想检索字符串的特定部分,唯一的是,由于这是一个目录,它的长度可以更改我想从字符串中检索文件名"C:\projects\Compiler\Compiler\src\JUnit\ExampleTest.java" "C:\projects\ExampleTest.java" 因此,在这两种情…

Java:增加YoungGen大小以提高GC性能 - java

我正在阅读以下文章:http://java.sun.com/docs/hotspot/gc1.4.2/example.html,无法理解以下几行:Young generation size is too small The young generation heap size in this first example is about 4 Mbytes w…

Java:静态字段在内存中的哪个位置? - java

如果我们将对象存储在对象的静态字段中,那么JVM如何为它分配内存?它是否存在于“隐式”(不确定我是否使用正确的单词)类对象中?静态字段与对象字段有何不同? 参考方案 静态字段是类变量,并且在该类的所有实例之间共享。实例变量(或我认为您引用它们的对象字段)属于类的各个实例,并且不共享。至于它们存储在内存中的位置将根据JVM的实现而定,因此没有理由需要两个不同的…