O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.5. Thread Groups

While threads can be created and run individually, sometimes it is easier to work with threads as a group, rather than one at a time. Operations that affect threads, such as suspending and resuming threads, stopping them cold, or interrupting them, can be performed on individual threads, but this requires developers to maintain a list of threads (using a data structure such as a vector or an array). When an operation must be performed, each and every thread in this list must be traversed and then acted upon. This creates extra work for developers by requiring more complex code. An easier alternative is to group threads together and apply an operation on the group rather than on the individual elements of the group.

The Java ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required