Skip to content

Commit

Permalink
8207908: JMXStatusTest.java fails assertion intermittently
Browse files Browse the repository at this point in the history
Reviewed-by: cjplummer, amenkov
  • Loading branch information
kevinjwalls committed Jul 11, 2024
1 parent cf940e1 commit b7d0eff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -88,8 +88,6 @@ public final void setup() throws Exception {
args.addAll(getCustomVmArgs());
args.add(TEST_APP_NAME);
testAppPb = ProcessTools.createTestJavaProcessBuilder(args);

jcmd = new ManagementAgentJcmd(TEST_APP_NAME, false);
}

@BeforeMethod
Expand All @@ -98,6 +96,7 @@ public final void startTestApp() throws Exception {
TEST_APP_NAME, testAppPb,
(Predicate<String>)l->l.trim().equals("main enter")
);
jcmd = new ManagementAgentJcmd(testApp, false);
}

@AfterMethod
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -174,7 +174,7 @@ private String jcmd(String ... command) throws IOException, InterruptedException
* @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);
}

/**
Expand Down

5 comments on commit b7d0eff

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sendaoYan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk23u

@sendaoYan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on b7d0eff Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sendaoYan the backport was successfully created on the branch backport-sendaoYan-b7d0eff5-master in my personal fork of openjdk/jdk23u. To create a pull request with this backport targeting openjdk/jdk23u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit b7d0eff5 from the openjdk/jdk repository.

The commit being backported was authored by Kevin Walls on 11 Jul 2024 and was reviewed by Chris Plummer and Alex Menkov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk23u:

$ git fetch https://github.com/openjdk-bots/jdk23u.git backport-sendaoYan-b7d0eff5-master:backport-sendaoYan-b7d0eff5-master
$ git checkout backport-sendaoYan-b7d0eff5-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk23u.git backport-sendaoYan-b7d0eff5-master

@openjdk
Copy link

@openjdk openjdk bot commented on b7d0eff Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sendaoYan the backport was successfully created on the branch backport-sendaoYan-b7d0eff5-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit b7d0eff5 from the openjdk/jdk repository.

The commit being backported was authored by Kevin Walls on 11 Jul 2024 and was reviewed by Chris Plummer and Alex Menkov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-sendaoYan-b7d0eff5-master:backport-sendaoYan-b7d0eff5-master
$ git checkout backport-sendaoYan-b7d0eff5-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-sendaoYan-b7d0eff5-master

Please sign in to comment.