当前位置:网站首页>JVM architecture, classloader, parental delegation mechanism
JVM architecture, classloader, parental delegation mechanism
2022-07-02 15:16:00 【Hanshhh】
1.JVM Architecture of
2. Class loader
1. The loader of the virtual machine
2. Start class ( root ) loader
3. Extend the classloader
4. Application Loader
public class Car {
public static void main(String[] args) {
// Class is a template , Object is specific , Store in a pile
Car car1 = new Car();
Car car2 = new Car();
Car car3 = new Car();
System.out.println(car1.hashCode());
System.out.println(car2.hashCode());
System.out.println(car3.hashCode());
Class<? extends Car> aClass1=car1.getClass();
Class<? extends Car> aClass2=car2.getClass();
Class<? extends Car> aClass3=car3.getClass();
System.out.println(aClass1.hashCode());
System.out.println(aClass2.hashCode());
System.out.println(aClass3.hashCode());
ClassLoader classLoader = aClass1.getClassLoader();
System.out.println(classLoader);//AppClassLoader
System.out.println(classLoader.getParent());//ExtClassLoader
System.out.println(classLoader.getParent().getParent());//null 1. non-existent 2.java The program cannot get (c file )rt.jar
}
}
The operation effect is as follows :
356573597
1735600054
21685669
1956725890
1956725890
1956725890
sun.misc.Launcher$AppClassLoader@18b4aac2
sun.misc.Launcher$ExtClassLoader@7f31245a
null
3. Parent delegate mechanism
effect :(1) Prevent malicious code from interfering with well meaning code ;
(2) Guard the trusted class library boundary ;
/* * 1. Class loader received a class load request * 2. Delegate this request up to the parent loader to complete , All the way up , Until you start the class loader * 3. Start the class loader to check whether the current class can be loaded , If you can load it, it's over , Use current loader , otherwise , Throw an exception , Notify the subclass loader to load * 4. Repeat step 3 * */
expand :
Sandbox security mechanism : Put the code in a protected domain , Determine what the code can do .
native: I've brought native Keywords , explain java It doesn't reach the scope of , Will call the underlying layer c The library of languages !( It goes to the local method stack , Call the local method interface JNI,(JNI effect : Expand java Use , Integrate different programming languages into Java used !))
Method area : Static variables static, Constant final, Class information ( Construction method 、 Interface definition )Class、 The constant pool of runtime exists in the method area , But instance variables exist in heap memory , It has nothing to do with the method area
边栏推荐
- How to solve the problem of database content output
- Map introduction
- 03_线性表_链表
- Key points of compilation principle examination in 2021-2022 academic year [overseas Chinese University]
- 871. Minimum refueling times: simple priority queue (heap) greedy question
- Implementation of n queen in C language
- [c voice] explain the advanced pointer and points for attention (2)
- 13_Redis_事务
- vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)
- 04_ Stack
猜你喜欢
Btrace- (bytecode) dynamic tracking tool
vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)
Learn the method code example of converting timestamp to uppercase date using PHP
About text selection in web pages and counting the length of selected text
Practical debugging skills
MFC 定时器使用
GeoServer offline map service construction and layer Publishing
Introduction to mathjax (web display of mathematical formulas, vector)
[untitled] leetcode 2321 Maximum score of concatenated array
Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
随机推荐
C语言中的printf函数和scanf函数
02_线性表_顺序表
数据分析思维分析方法和业务知识——业务指标
The past and present lives of visual page building tools
TiDB跨数据中心部署拓扑
Kibana basic operation
IE 浏览器正式退休
XML配置文件
Tidb environment and system configuration check
06_ Stack and queue conversion
15_Redis_Redis.conf详解
N皇后问题的解决
学习使用php将时间戳转换为大写日期的方法代码示例
Table responsive layout tips
Base64 编码原来还可以这么理解
Mavn 搭建 Nexus 私服
[solution] educational codeforces round 82
08_ strand
18_Redis_Redis主从复制&&集群搭建
Recommended configuration of tidb software and hardware environment