1 Star 0 Fork 82

starlet_dx/openjdk-1.8.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
8157570.patch 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
From 1ae617207543d079b95384bc2a57996392d5df09 Mon Sep 17 00:00:00 2001
Date: Fri, 22 Jan 2021 11:30:40 +0800
Subject: Backport of JDK-8157570
summary: sun.rmi.transport.GC retains a strong reference to the context class loader
LLT:
Bug url: https://bugs.openjdk.java.net/browse/JDK-8157570
---
jdk/src/share/classes/sun/misc/GC.java | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/jdk/src/share/classes/sun/misc/GC.java b/jdk/src/share/classes/sun/misc/GC.java
index c77bf1d05..eb92617c1 100644
--- a/jdk/src/share/classes/sun/misc/GC.java
+++ b/jdk/src/share/classes/sun/misc/GC.java
@@ -29,6 +29,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.SortedSet;
import java.util.TreeSet;
+import sun.misc.InnocuousThread;
/**
@@ -83,8 +84,9 @@ public class GC {
public static native long maxObjectInspectionAge();
- private static class Daemon extends Thread {
+ private static class Daemon implements Runnable {
+ @Override
public void run() {
for (;;) {
long l;
@@ -122,23 +124,17 @@ public class GC {
}
}
- private Daemon(ThreadGroup tg) {
- super(tg, "GC Daemon");
- }
-
- /* Create a new daemon thread in the root thread group */
+ /* Create a new daemon thread */
public static void create() {
PrivilegedAction<Void> pa = new PrivilegedAction<Void>() {
public Void run() {
- ThreadGroup tg = Thread.currentThread().getThreadGroup();
- for (ThreadGroup tgn = tg;
- tgn != null;
- tg = tgn, tgn = tg.getParent());
- Daemon d = new Daemon(tg);
- d.setDaemon(true);
- d.setPriority(Thread.MIN_PRIORITY + 1);
- d.start();
- GC.daemon = d;
+ Thread t = InnocuousThread.newSystemThread("RMI GC Daemon",
+ new Daemon());
+ assert t.getContextClassLoader() == null;
+ t.setDaemon(true);
+ t.setPriority(Thread.MIN_PRIORITY + 1);
+ t.start();
+ GC.daemon = t;
return null;
}};
AccessController.doPrivileged(pa);
--
2.19.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/starlet-dx/openjdk-1.8.0.git
git@gitee.com:starlet-dx/openjdk-1.8.0.git
starlet-dx
openjdk-1.8.0
openjdk-1.8.0
master

搜索帮助