On Tue, 25 Mar 2025 20:36:28 GMT, Chris Plummer <[email protected]> wrote:
> Calling ThreadGroupReference.groups() from an event handler can cause a
> deadlock. Details in first comment. Tested with :jdk_lang on all supported
> platforms and tier1, tier2, tier3, and tier5 svc testing.
src/java.base/share/classes/java/lang/ThreadGroup.java line 664:
> 662: private ThreadGroup[] subgroupsAsArray() {
> 663: List<ThreadGroup> groups = synchronizedSubgroups();
> 664: return groups.toArray(new ThreadGroup[groups.size()]);
Hello Chris, would a comment on this line be necessary to prevent future (IDE
encouraged [1]) refactoring of this code back to `toArray(new ThreadGroup[0])`?
[1]
<img width="983" alt="toArray"
src="https://github.com/user-attachments/assets/643e66b8-c18a-4a10-8961-2aa3b2869fcc"
/>
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24236#discussion_r2013272532