java - When should one create new Thread Groups -


i wondering, advantages of assigning threads thread group instead of containing them in 1 (the main) group?

assuming there 10 or more active threads, , couple of threads been initiated every , again application requires, how 1 approach grouping these?

thanks, adam.

there no advantage @ all. threadgroups there backward compatibility, i've never seen them used.

here's brian goetz (author of java concurrency in practice - bible) said them long time ago:

the threadgroup class intended useful in structuring collectionsof threads groups. however, turns out threadgroup not useful. better off using equivalent methods in thread. threadgroup offer 1 useful feature not (yet) present in thread: uncaughtexception() method. when thread within thread group exits becauseit threw uncaught exception, threadgroup.uncaughtexception() method called. gives opportunity shut down system, write message log file, or restart failed service.

threads have uncauht exception handler, , single reason use thread groups isn't valid anymore.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -