diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java index 13a4f7bea73..3d125325449 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -72,7 +72,7 @@ public class JMXStartStopTest { private static final boolean verbose = false; - private static ManagementAgentJcmd jcmd = new ManagementAgentJcmd(TEST_APP_NAME, verbose); + private static ManagementAgentJcmd jcmd; private static void dbg_print(String msg) { if (verbose) { @@ -347,6 +347,7 @@ public synchronized void start() throws InterruptedException, IOException, Timeo "the requested port not being available"); } pid = p.pid(); + jcmd = new ManagementAgentJcmd(p, verbose); } catch (TimeoutException e) { if (p != null) { p.destroy(); diff --git a/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java b/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java index fc7a0de2d06..e3703ba8dbc 100644 --- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java +++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.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 @@ -67,7 +67,6 @@ public static void setupClass() throws Exception { @BeforeTest public void setup() { - jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false); } @BeforeMethod @@ -76,6 +75,7 @@ public void startTestApp() throws Exception { TEST_APP_NAME, testAppPb, (Predicate<String>)l->l.trim().equals("main enter") ); + jcmd = new ManagementAgentJcmd(testApp, false); } @AfterMethod