六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 40|回复: 0

[Tomcat源码系列] Tomcat 类加载器结构

[复制链接]

升级  26%

21

主题

21

主题

21

主题

秀才

Rank: 2

积分
89
 楼主| 发表于 2013-2-4 19:49:43 | 显示全部楼层 |阅读模式
一、从类加载器(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.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表