Hi all, Test test/jdk/java/lang/management/MemoryMXBean/StressGetTotalGcCpuTimeDuringShutdown.java observed intermittently timed out, both with ZGC and Shenandoah GC. This test create number of $(nproc)*8 daemon theads, and all these threads invoke ManagementFactory.getMemoryMXBean()getTotalGcCpuTime() in the while(true) loop. If the tested machine has many cpu cores, this test will create too many threads and cause too huge stress, thus test intermittently timed out.
This PR limited the max thread number to 128, this will reduce the thread number pressure. And add `Thread.onSpinWait()` in the while(true) loop will make loop less busy, this change do not change the original test intention. Before this change, test failure probability about 5/1000. After this change test run 1000 times and all passed on linux-x64/linux-aarch64. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - update copyright year - 8376885: StressGetTotalGcCpuTimeDuringShutdown.java intermittently timed out Changes: https://git.openjdk.org/jdk/pull/30983/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30983&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8376885 Stats: 7 lines in 1 file changed: 4 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/30983.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30983/head:pull/30983 PR: https://git.openjdk.org/jdk/pull/30983
