Skip to content
Permalink
Browse files
8081652: [TESTBUG] java/lang/management/ThreadMXBean/ThreadMXBeanStat…
…eTest.java timed out intermittently

Reviewed-by: mdoerr
Backport-of: 5805cbe
  • Loading branch information
GoeLin committed Sep 28, 2021
1 parent 1476158 commit b433235d3b9bc475fe1445d6e8a38d6b748e39fa
Showing with 15 additions and 5 deletions.
  1. +0 −1 test/jdk/ProblemList.txt
  2. +11 −2 test/jdk/java/lang/Thread/ThreadStateController.java
  3. +4 −2 test/jdk/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java
@@ -547,7 +547,6 @@ java/lang/instrument/BootClassPath/BootClassPathTest.sh 8072130 macosx-a
java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all

java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8081652 generic-all
java/lang/management/ThreadMXBean/AllThreadIds.java 8131745 generic-all

############################################################################
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, 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
@@ -359,7 +359,16 @@ private void log(String msg, Object ... params) {
* @throws InterruptedException
*/
public String getLog() throws InterruptedException {
this.join();
return getLog(0);
}

/**
* Waits at most {@code millis} milliseconds for the controller
* to complete the test run and returns the generated log.
* A timeout of {@code 0} means to wait forever.
*/
public String getLog(long millis) throws InterruptedException {
this.join(millis);

return logger.toString();
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@@ -38,6 +38,8 @@
* @run main ThreadMXBeanStateTest
*/

import jdk.test.lib.Utils;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.lang.management.ThreadInfo;
@@ -114,7 +116,7 @@ public static void main(String[] argv) throws Exception {
thread.checkThreadState(TERMINATED);
} finally {
try {
System.out.println(thread.getLog());
System.out.println(thread.getLog(Utils.adjustTimeout(60_000)));
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("TEST FAILED: Unexpected exception.");

1 comment on commit b433235

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on b433235 Sep 28, 2021

Please sign in to comment.