• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Groups

 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently a thread group can be destroyed thereby destroying all contained threads. Why can thread groups be destroyed but not individual threads? Would it therefore be a legitimate technique to put each thread into its own ThreadGroup if it is desirable that errant threads in an application be destroyed?
 
Andrew Sancroff
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Destroys this thread group and all of its subgroups. This thread group must be empty, indicating that all threads that had been in this thread group have since stopped."
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All threads in the group must be already stopped? What happens if you issue a destroy command on a ThreadGroup that has threads still running?
 
Andrew Sancroff
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is all in the JDK JavaDoc...

Throws:
IllegalThreadStateException - if the thread group is not empty or if the thread group has already been destroyed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!