RFR 8078143: java/lang/management/ThreadMXBean/AllThreadIds.java fails intermittently

Jaroslav Bachorik jaroslav.bachorik at oracle.com
Sat May 16 09:18:16 UTC 2015


On 15.5.2015 22:59, Martin Buchholz wrote:
> You may submit, but:
>
> ---
>
> the @test is _NOT_ a javadoc comment - /* is more standard.
> http://openjdk.java.net/jtreg/tag-spec.html#EXAMPLES
>
> -/*
> +/**
>    * @test
>    * @bug     4530538
>    * @summary Basic unit test of ThreadMXBean.getAllThreadIds()
> @@ -32,9 +32,30 @@
>    */

Will do.

>
>
>
> On Thu, May 14, 2015 at 3:11 AM, Jaroslav Bachorik
> <jaroslav.bachorik at oracle.com <mailto:jaroslav.bachorik at oracle.com>> wrote:
>
>     On 13.5.2015 21:14, Martin Buchholz wrote:
>
>
>
>         It's common for users to introduce parallelism in classloaders or
>         jar-loaders (we do this at google) which may cause arbitrary thread
>         fluctuations.  That makes this particular API rather difficult
>         to test
>         robustly, especially if you are only testing against the spec.
>
>
>     Well, in such an environment this test makes absolutely no sense -
>     there is nothing deterministic in the thread counters we could
>     assert against.
>
>
> Consider creating a private thread group just for the test and
> restricting the count assertions to just threads in that thread group -
> that should be reliable (even if other tests are running concurrently in
> the same VM).

I don't know how would you want to make this work. The ThreadMXBean 
counters are global per VM. Per thread group statistics are not supported.

-JB-


More information about the serviceability-dev mailing list