On Tue, 8 Nov 2022 10:05:34 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> The JVM code took a ThreadGroup lock before poking into ThreadGroup fields. >> Call a method in the ThreadGroup to call the synchronized method instead. >> Tested with tier 1-4. > > src/java.base/share/classes/java/lang/ThreadGroup.java line 802: > >> 800: int length = groups.size(); >> 801: return groups.toArray(new ThreadGroup[length]); >> 802: } > > Would you mind changing the comment to "Returns a snapshot of the subgroups > as an array, used by JVMTI.", only to be consistent with the other methods > that return subgroups as they all document it as a "snapshot". Also I think I > would rename this to subgroupsAsArray as there isn't a "subgroups array". > > If you want, `return groups.toArray(new ThreadGroup[0]);` will do the sizing > for you. > > Minor nit, you've additional blank lines after this method, I assume you only > meant to add one. Thank you for looking at this - that's a much better name and comment and thanks for the Java hints (I copied that from somewhere else). ------------- PR: https://git.openjdk.org/jdk/pull/11033