ThreadGroup在创建单独的线程方面有什么好处? [英] What is the benefit of ThreadGroup in java over creating separate threads?

查看:347
本文介绍了ThreadGroup在创建单独的线程方面有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多方法,例如 stop() resume() suspend()等已弃用。

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

因此使用 ThreadGroup 创建线程是否有用?

So is it useful to create threads using ThreadGroup?

推荐答案

使用 ThreadGroup 可以成为大型应用服务器中的一种有用的诊断技术线程。如果您的线程在逻辑上组合在一起,那么当您获得堆栈跟踪时,您可以看到违规线程所属的组(例如Tomcat线程,MDB线程,线程池X等),这可以是在追踪和解决问题方面有很大的帮助。

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.

这篇关于ThreadGroup在创建单独的线程方面有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆