[Tomcat源码系列] Tomcat 类加载器结构
一、从类加载器(ClassLoader)结构说起1.基本介绍(此部分可参见<<Core Java 2 Volume II>> Chapter9. Security)
顾名思义,类加载器是用于加载Java的类定义信息(.class)。需要注意的是类加载器仅在需要的才加载类定义信息,参见<<Core Java 2 Volume II>> Chapter9. Security关于ClassLoader的说明如下
<div class="quote_div"> Note that the virtual machine loads only those class files that are needed for the execution of a program. For example, suppose program execution starts with MyProgram.class. Here are the steps that the virtual machine carries out.
[*]The virtual machine has a mechanism for loading class files, for example, by reading the files from disk or by requesting them from the Web; it uses this mechanism to load the contents of the MyProgram class file.
[*]If the MyProgram class has instance variables or superclasses of another class type, these class files are loaded as well. (The process of loading all the classes that a given class depends on is called resolving the class.)
[*]The virtual machine then executes the main method in MyProgram (which is static, so no instance of a class needs to be created).
[*]If the main method or a method that main calls requires additional classes, these are loaded next.
页:
[1]