RFR: 8262001: java/lang/management/ThreadMXBean/ResetPeakThreadCount.java failed with "RuntimeException: Current Peak = 14 Expected to be == previous peak = 7 + 8"

Serguei Spitsyn sspitsyn at openjdk.java.net
Wed Mar 17 01:20:07 UTC 2021


On Tue, 9 Mar 2021 01:31:33 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> The fix updates ResetPeakThreadCount.java test - increases number of threads, but relaxes conditions so start/termination of system threads don't cause failures.
> Additional changes:
> - store threads in a list instead of array (we need only to start/terminate some number of threads, so linked list works better);
> - flags for thread termination are moved to thread class;
> - store values from ThreadMXBean.getPeakThreadCount() and getThreadCount() in int instead of long (the methods return int values)

Alex,
This looks good to me.
Nit:
The line needs a dot (was missed in the original code):
`+    // The MyThread thread lives as long as correspondent its live value is true`

Thanks,
Serguei

-------------

Marked as reviewed by sspitsyn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2885


More information about the serviceability-dev mailing list