8207908: JMXStatusTest.java fails assertion intermittently
Reviewed-by: cjplummer, amenkov
This commit is contained in:
parent
cf940e139a
commit
b7d0eff5ad
test/jdk/sun/management/jmxremote/startstop
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user