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

Martin Buchholz martinrb at google.com
Mon May 18 21:04:09 UTC 2015


On Sat, May 16, 2015 at 2:18 AM, Jaroslav Bachorik <
jaroslav.bachorik at oracle.com> wrote:

> On 15.5.2015 22:59, Martin Buchholz wrote:
>
>>
>> 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.


Well, yes, this API is inherently hard to test, but if you filtered the
returned data to restrict to just one thread group, where you have control
over all threads in the thread group, then you should be able to make 100%
reliable assertions about the completeness.  You will not be able to prove
that the returned information from e.g. getThreadCount is accurate, but it
should at least be >= the count of live threads that you can control.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20150518/e65bf6c0/attachment.html>


More information about the serviceability-dev mailing list