Thread Groups

The ThreadGroup class can be used to establish some thread security and authorization constraints on threads. It is also a way to group threads together so that actions can be performed on an entire set of threads. For example, you can start or stop all the threads within a ThreadGroup. After a thread is inserted into a ThreadGroup, it can't be put into a different ThreadGroup.

Most Java developers don't use ThreadGroups. That is, they just create new threads and accept whatever ThreadGroup the default is and put the new thread into that group. By default, all threads that are created belong to the default ThreadGroup of the main thread or a ThreadGroup called main. This is the same ThreadGroup in which the main thread is running. ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.