JDK-8220516 : ThreadGroup::destroy may leave the thread group in an inconsistent state.
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2019-03-12
  • Updated: 2020-11-29
  • Resolved: 2020-11-29
Related Reports
Relates :  
Relates :  
Description
The issue may happen if ThreadGroup::destroy is called when one of its children still has active threads. In that case, destroy() will throw an IllegalStateException, but only after the group has been marked as destroyed.
Comments
The destroy, isDestroyed, setDaemon, and isDaemon methods have been terminally deprecated in Java 16 so they can be removed in a future release. No plan to try to fix issues in methods for this fundamentally flawed API and mechanism so I will close this issue.
29-11-2020

TheadGroup destroy is fundamentally flawed. The approach that we will likely take here is to terminally deprecate detstroy/isDestroyed and have thread groups be weakly reachable from their parent so that they can be GC'ed when there are no active threads and otherwise not strongly reachable.
02-09-2020

See also JDK-8219197
12-03-2019