Skip to content

Commit 5805cbe

Browse files
author
Daniil Titov
committedJun 8, 2020
8081652: [TESTBUG] java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java timed out intermittently
Reviewed-by: cjplummer, dholmes
1 parent ea9aeda commit 5805cbe

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed
 

‎test/jdk/ProblemList.txt

-2
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,6 @@ java/lang/instrument/RetransformBigClass.sh 8065756 generic-
577577
java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all
578578
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all
579579

580-
java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8081652 generic-all
581-
582580
javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-all
583581
javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java 8227337 generic-all
584582

‎test/jdk/java/lang/Thread/ThreadStateController.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -359,7 +359,16 @@ private void log(String msg, Object ... params) {
359359
* @throws InterruptedException
360360
*/
361361
public String getLog() throws InterruptedException {
362-
this.join();
362+
return getLog(0);
363+
}
364+
365+
/**
366+
* Waits at most {@code millis} milliseconds for the controller
367+
* to complete the test run and returns the generated log.
368+
* A timeout of {@code 0} means to wait forever.
369+
*/
370+
public String getLog(long millis) throws InterruptedException {
371+
this.join(millis);
363372

364373
return logger.toString();
365374
}

‎test/jdk/java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
3636
* @run main ThreadMXBeanStateTest
3737
*/
3838

39+
import jdk.test.lib.Utils;
40+
3941
import java.lang.management.ManagementFactory;
4042
import java.lang.management.ThreadMXBean;
4143
import java.lang.management.ThreadInfo;
@@ -112,7 +114,7 @@ public static void main(String[] argv) throws Exception {
112114
thread.checkThreadState(TERMINATED);
113115
} finally {
114116
try {
115-
System.out.println(thread.getLog());
117+
System.out.println(thread.getLog(Utils.adjustTimeout(60_000)));
116118
} catch (InterruptedException e) {
117119
e.printStackTrace();
118120
System.out.println("TEST FAILED: Unexpected exception.");

0 commit comments

Comments
 (0)
Please sign in to comment.