当前位置:网站首页>双亲委派机制
双亲委派机制
2022-07-24 16:35:00 【isTrueLoveColour】
java虚拟机对class文件采用的是按需加载的方式,也就是说只有在需要使用这个类时,才会将它的class文件加载到内存生成class对象,加载类文件时采用的双亲委派模式,也就是把请求交给父类处理,也就是说,
- 如果一个类加载器收到了类加载的请求,并不会自己先去加载,而是把这个请求委托给父类的加载器去执行
- 如果父类的加载器还存在其父类的加载器,就会进一步向上委托,直到达到最顶层的引导类加载器
- 如果父类加载器可以完成加载任务,就会直接返回,只有父类加载器不能完后任务时,子类加载器才回去尝试加载,这也就是双亲委派模式
这样就可以避免类的重复加载;并且保护程序安全,防止核心api被篡改
例如你可以自定义一个Object类,但是你无法使用它
边栏推荐
- Urban safety series popular science - enter the high incidence period of drowning, if you know the common sense of life-saving
- Huawei Kirin 985 mass production in the third quarter: TSMC 7Nm EUV process, integrated 5g baseband!
- Dongfang Guangyi refuted the rumor late at night, saying that the news that the hammer was filed for investigation was untrue!
- Creation and inheritance of JS class
- 2019q1 global smartphone shipments: Huawei vivo increased significantly, while Apple plummeted 30.2%!
- 剑指 Offer 22. 链表中倒数第k个节点
- What are the safe securities companies? I want to buy stocks on my mobile phone
- “天上天下,唯我独尊”——单例模式
- Qt设计机器人仿真控制器——按键控制机器人关节转动
- 在 PHP Web 应用程序中防止 XSS 的最佳实践
猜你喜欢

Mobile phone comparison redmi note8 and realm x2

EventLoop event loop mechanism

About SQL data query statements

Servlet framework (servlet+jsp) + addition, deletion, modification and query + paging implemented by MySQL (function package student information entry, addition, deletion, modification and query of st

ArcGIS create vector

15. ARM embedded system: how to debug single board with PC

Getting started with ARP

Rest style

How vscode mouse wheel enlarges the interface

会议OA项目进度(二)
随机推荐
Qt设计仿真机器人控制器
随笔记:同步、异步和微任务、宏任务的打印顺序
百度推广“删除重提”是什么意思?
Duplicate content in lookup table
"Heaven and the world, self-respect" -- single case mode
在 PHP Web 应用程序中防止 XSS 的最佳实践
[LeetCode]75.颜色分类——题解(执行用时击败90% ,内存消耗击败 78%)
简单使用 MySQL 索引
【机器学习基础】——另一个视角解释SVM
[leetcode] skillfully use bit operation
What are the safe securities companies? I want to buy stocks on my mobile phone
2019q1 global smartphone shipments: Huawei vivo increased significantly, while Apple plummeted 30.2%!
JUC source code learning note 3 - AQS waiting queue and cyclicbarrier, BlockingQueue
如何在 PHP 中防止 XSS
Codeforces round 690 (Div. 3) B. last year's substring conventional solution
EMQ Yingyun technology was listed on the 2022 "cutting edge 100" list of Chinese entrepreneurs
ArcGIS layer annotation display
Servlet框架(servlet+jsp)+Mysql实现的增删改查+分页(功能包学生信息录入、学生信息增删改查、分页等)
15. ARM embedded system: how to debug single board with PC
剑指 Offer 25. 合并两个排序的链表