1 Star 0 Fork 12

莫比乌斯/openjdk-21

forked from src-openEuler/openjdk-21 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Backport-JDK-8207908-JMXStatusTest.java-fails-assert.patch 2.93 KB
一键复制 编辑 原始数据 按行查看 历史
wuyafang 提交于 2024-10-14 11:38 . sync bishengjdk21 patches
Subject: Backport JDK-8207908 JMXStatusTest.java fails assertion intermittently
---
.../management/jmxremote/startstop/JMXStatusTest.java | 5 ++---
.../jmxremote/startstop/ManagementAgentJcmd.java | 10 +++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java
index 1e6259ef0..fc1b48832 100644
--- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -88,8 +88,6 @@ abstract public class JMXStatusTest {
args.addAll(getCustomVmArgs());
args.add(TEST_APP_NAME);
testAppPb = ProcessTools.createTestJavaProcessBuilder(args);
-
- jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false);
}
@BeforeMethod
@@ -98,6 +96,7 @@ abstract public class JMXStatusTest {
TEST_APP_NAME, testAppPb,
(Predicate<String>)l->l.trim().equals("main enter")
);
+ jcmd = new ManagementAgentJcmd(testApp, false);
}
@AfterMethod
diff --git a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java
index 0781bc941..7135f6ea2 100644
--- a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java
+++ b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,11 +47,11 @@ final class ManagementAgentJcmd {
private static final String CMD_STATUS = "ManagementAgent.status";
private static final String CMD_PRINTPERF = "PerfCounter.print";
- private final String id;
+ private final long pid;
private final boolean verbose;
- public ManagementAgentJcmd(String targetApp, boolean verbose) {
- this.id = targetApp;
+ public ManagementAgentJcmd(Process targetApp, boolean verbose) {
+ this.pid = targetApp.pid();
this.verbose = verbose;
}
@@ -174,7 +174,7 @@ final class ManagementAgentJcmd {
* @throws InterruptedException
*/
private String jcmd(Consumer<String> c, String ... command) throws IOException, InterruptedException {
- return jcmd(id, c, command);
+ return jcmd(Long.toString(pid), c, command);
}
/**
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/neu-mobi/openjdk-21.git
git@gitee.com:neu-mobi/openjdk-21.git
neu-mobi
openjdk-21
openjdk-21
master

搜索帮助