Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8081652: [TESTBUG] java/lang/management/ThreadMXBean/ThreadMXBeanStat…
…eTest.java timed out intermittently

Reviewed-by: cjplummer, dholmes
  • Loading branch information
Daniil Titov committed Jun 8, 2020
1 parent ea9aeda commit 5805cbeaaf72657bbd758766d47261dd5c74e70b
Showing with 15 additions and 6 deletions.
  1. +0 −2 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
@@ -577,8 +577,6 @@ java/lang/instrument/RetransformBigClass.sh 8065756 generic-
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

javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-all
javax/management/remote/mandatory/connection/MultiThreadDeadLockTest.java 8227337 generic-all

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, 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
@@ -36,6 +36,8 @@
* @run main ThreadMXBeanStateTest
*/

import jdk.test.lib.Utils;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.lang.management.ThreadInfo;
@@ -112,7 +114,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.");

0 comments on commit 5805cbe

Please sign in to comment.