You should move the Arrays.stream trigger call to before the ManagementFactory.getThreadMXBean, otherwise the threads you get from ThreadMXBean will not match the threads you get from the ThreadGroups.
> On 18 mars 2016, at 12:17, Harsha Wardhana B <[email protected]> > wrote: > > Hello All, > > Please review fix for, > > Issue : JDK-8151797 <http://jdk-8151797/> - > java/lang/management/ThreadMXBean/ThreadLists.java : inconsistent results > Webrev : http://cr.openjdk.java.net/~hb/8151797/webrev.00/ > <http://cr.openjdk.java.net/%7Ehb/8151797/webrev.00/> > > Root-cause : call-site cleaner thread not started before counting threads > via Thread.getAllStackTraces();. > Fix : Create ThreadMXBean at the beginning of test so that call-site cleaner > thread will be started. > > Thanks > Harsha >
