allan.jacobs@Eng 1998-06-12
ThreadGroup destroy is specified so that the destruction of parent
groups occurs before the recursive destruction of it's children.
If one of the child groups throws an exception instead of dying
quietly, then this child will be orphaned and will no longer be
accessible via a ThreadGroup heirarchy. I think that the destruction
should be bottom up to fix the problem.
The actual implementation conforms to the current specification --
destruction is not bottom up.
The present wording:
"This thread group is destroyed. If it has already been destroyed, or
if any threads belong to it directly, then an IllegalThreadStateException
is thrown. Otherwise, this method is called recursively for every thread
group that belongs to this thread group, and this thread group is
removed from its parent thread group."
The wording should be:
"Before a thread group is destroyed, this method is called recursively
for every thread group that belongs to this thread group. If one of the
children is not destroyed, this does not affect the attempts to destroy
any of the other children. If any of the children throw an
IllegalThreadStateException then this thread group will throw an
IllegalThreadStateException.
Otherwise, this thread group's children can be considered destroyed.
If this thread group has already been destroyed, or if any threads belong
to it directly, an IllegalThreadStateException is thrown.
Finally, if a thread group's children are destroyed and no threads belong
to it directly then the thread group is destroyed and removed from it's
parent's thread group."
ThreadGroup destroy is specified so that the destruction of parent
groups occurs before the recursive destruction of it's children.
If one of the child groups throws an exception instead of dying
quietly, then this child will be orphaned and will no longer be
accessible via a ThreadGroup heirarchy. I think that the destruction
should be bottom up to fix the problem.
The actual implementation conforms to the current specification --
destruction is not bottom up.
The present wording:
"This thread group is destroyed. If it has already been destroyed, or
if any threads belong to it directly, then an IllegalThreadStateException
is thrown. Otherwise, this method is called recursively for every thread
group that belongs to this thread group, and this thread group is
removed from its parent thread group."
The wording should be:
"Before a thread group is destroyed, this method is called recursively
for every thread group that belongs to this thread group. If one of the
children is not destroyed, this does not affect the attempts to destroy
any of the other children. If any of the children throw an
IllegalThreadStateException then this thread group will throw an
IllegalThreadStateException.
Otherwise, this thread group's children can be considered destroyed.
If this thread group has already been destroyed, or if any threads belong
to it directly, an IllegalThreadStateException is thrown.
Finally, if a thread group's children are destroyed and no threads belong
to it directly then the thread group is destroyed and removed from it's
parent's thread group."
- relates to
-
JDK-4835100 (thread) ThreadGroup.destroy() does not destroy the subgroup
- Closed