当前位置:网站首页>Classloader and parental delegation mechanism
Classloader and parental delegation mechanism
2022-07-02 07:18:00 【Software development heart】
One 、 Class loader model
There is a class Car, Created 3 An example :
Print 3 individual car class hashcode, The address is different (356573597,1735600054,
21685669); But through this, this 3 An example , Get the original class , The address is the same (1956725890), Explain this 3 All classes come from the same template .
Two 、 Parent delegate mechanism
Let's talk about the class loader type first , Altogether 4 Kind of :
1. Virtual machine loader
2. Start class ( root ) loader
3. Extend the classloader
4. Applications ( System class ) loader

To build a java.lang Under the same name String Method , Print test , Tips main No way to find 
This is java A mechanism to ensure security ,java Runtime , Find the class loader in the following order :
1. Class loader received class load request
2. Delegate this class loading request upward to the parent class 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
5. All loaders failed to load , Throw an exception :Class Not Found
What we found this time is jre\lib\rt.jar Under the bag java.lang.String.toString() Method execution , This method is not main Methodical , So wrong reporting , In this way, the programmer can avoid misoperation and modification java Standard package for , Ensure the security of the system .
边栏推荐
猜你喜欢

ERNIE1.0 与 ERNIE2.0 论文解读

sqli-labs通關匯總-page2

Basic knowledge of software testing

Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool

【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦

搭建frp进行内网穿透

第一个快应用(quickapp)demo

MySQL无order by的排序规则因素

Principle analysis of spark

Sqli labs customs clearance summary-page1
随机推荐
TCP攻击
UEditor . Net version arbitrary file upload vulnerability recurrence
Go common compilation fails
Brief analysis of PHP session principle
2021-07-05c /cad secondary development create arc (4)
Thinkphp5中一个字段对应多个模糊查询
实现接口 Interface Iterable<T>
在php的开发环境中如何调取WebService?
A summary of a middle-aged programmer's study of modern Chinese history
2021-07-17C#/CAD二次开发创建圆(5)
Oracle EBs and apex integrated login and principle analysis
How to call WebService in PHP development environment?
Oracle apex Ajax process + dy verification
一个中年程序员学习中国近代史的小结
Conda 创建,复制,分享虚拟环境
oracle-外币记账时总账余额表gl_balance变化(上)
第一个快应用(quickapp)demo
腾讯机试题
Use of interrupt()
view的绘制机制(三)