Warning: Use of undefined constant fixed - assumed 'fixed' (this will throw an Error in a future version of PHP) in /home/webtro13/domains/farenda.com/public_html/wp-content/themes/moments/header.php on line 65
class="header_container_flat">

Java Programming Tutorials

Java programming tutorials with many code examples!

Java Thread Group

Problem:

What is Java Thread Group? How to use it? When to use it? Should Thread Groups be used at all?

Solution:

TL;DR: don’t.

As a longer answer can serve a quote from an excellent “Effective Java, 2nd” book by Josh Bloch, Item 73: Avoid thread groups:

To summarize, thread groups don’t provide much in the way of useful functionality, and much of the functionality they do provide is flawed. Thread groups are best viewed as an unsuccessful experiment, and you should simply ignore their existence. If you design a class that deals with logical groups of threads, you should probably use thread pool executors (Item 68).

So, please better read posts on thread pool executors or other topics on Java Concurrency.

Share with the World!