What is the benefit of ThreadGroup in java over creating separate threads?

后端 未结 5 1790
离开以前
离开以前 2020-12-14 17:32

Many methods like stop(), resume(), suspend() etc are deprecated.

So is it useful to create threads using ThreadGroup

5条回答
  •  伪装坚强ぢ
    2020-12-14 18:06

    Using ThreadGroup can be a useful diagnostic technique in big application servers with thousands of threads. If your threads are logically grouped together, then when you get a stack trace you can see which group the offending thread was part of (e.g. "Tomcat threads", "MDB threads", "thread pool X", etc), which can be a big help in tracking down and fixing the problem.

提交回复
热议问题