如何在Java中为线程池的线程命名[复制](How to name the threads of a thread pool in Java [duplicate])
这个问题在这里已经有了答案:
- 命名ExecutorService的线程和线程池 13个答案
我有一个使用
Executor
框架的Java应用程序,我看起来像这样的代码protected ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(5)
我的理解是,内部JVM会创建一个由5个线程组成的池。 现在,当我在探查器中检查执行时,我得到了类似于
thread-pool2,thread-pool3
等的内容。
Some of these thread pools are created by the server and some are created by me
, 我需要一种方法来区分哪些是由我创建的,哪些是由服务器创建的 。我在想,如果我可以命名线程池,它应该做的伎俩,但没有看到任何API,这将允许我这样做。
提前致谢。
This question already has an answer here:
I have a Java application that uses the
Executor
framework and I have code that looks like thisprotected ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(5)
My understanding is that internally the JVM would create a pool of 5 threads. Now when I check the execution in a profiler, I get something like
thread-pool2,thread-pool3
and so on.
Some of these thread pools are created by the server and some are created by me
, I need a way to differentiate which were created by me and which were created by the server.I am thinking that if I can name the thread pools it should do the trick, however do not see any API which would allow me to do the same.
Thanks in advance.
原文:https://stackoverflow.com/questions/5740478
最新回答
首先,确认你安装用户是administrator。 其次,这是orale控制台错误,没什么大不了的,不用它oracle也能用。查看下数据库是否能正常启动登录。实在不行,重建一下控制台
相关问答
更多-
无法显示网页,错误代码:503[2022-01-13]
Successful Client Requests 200 OK 201 Created 202 Accepted 203 Non-Authorative Information 204 No Content 205 Reset Content 206 Partial Content Client Request Redirected 300 Multiple Choices 301 Moved Permanently 302 Moved Temporarily 303 See Other 304 Not ... -
数据库 处理请求时错误代码200 ok[2023-04-06]
你是用IP地址后带phpmyadmin访问的吧?这个主要是域名或者IP地址没有被服务器信任导致,你可以将phpmyadmin整个目录移到网站根目录下,再用“网站域名/phpmyadmin”登陆进去;或者修改Apache/Nginx环境下的配置文件,一般是httpd.conf或者nginx.conf,然后找到Allow from 127.0.0.1 换成Allow from all即可 -
打开页面错误 错误代码:403[2022-05-19]
是网站管理员关闭或禁止访问指定页面而导致的。403错误,是网站访问过程中,常见的错误提示。 错误代码:403.1–执行访问被禁止 下面是导致此错误信息的两个常见原因: 1、您没有足够的执行许可 例如,如果试图访问的ASP页所在的目录权限设为“无”,或者,试图执行的CGI脚本所在的目录权限为“只允许脚本”,将出现此错误信息。若要修改执行权限,请在Microsoft管理控制台(MMC)中右击目录,然后依次单击属性和目录选项卡,确保为试图访问的内容设置适当的执行权限。 2、您没有将试图执行的文件类型的脚本映射设置 ... -
具体的错误信息如何的。 看来是账号没权限访问目录。 最好是将tomcat安装到D:\apache-tomcat-7这样的目录,并设置权限、允许服务启动使用的账号完全访问整个目录
-
错误代码err_failed[2023-06-07]
开始-运行-CMD-输出netsh winsock reset回车, 重启电脑,即可。 -
错误代码:0x80070002[2024-02-08]
解决方法:在 Windows 中恢复系统/启动驱动器的驱动器号。 概要 警告:在驱动器号未更改的计算机中,不要使用本文介绍的过程。否则,可能无法启动操作系统。仅当需要从驱动器号更改中恢复时才执行本文中描述的过程,而不能使用该过程来更改现有的计算机驱动器。进行此更改之前,请先备份注册表项。 有关更多信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章: 249321 (http://support.microsoft.com/kb/249321/) 如启动分区驱动器号已更改则无法登录 本 ... -
Free Pascal错误代码[2022-05-18]
这是从百度上下载的,看看: Free Pascal错误代码表 1 Invalid function number 错误的功能代码 尝试错误的操作系统调用. 2 File not found 文件未找到 程序试图删除(erase),重命名( rename),打开(open)一个不存在的文件. 3 Path not found 目录未发现 目录不存在或是错误.也有可能是访问一个不存在的文件. 4 Too many open files 打开太多的文件 当前你的程序当前打开的文件太多咯.超过了操作系统允许打开的最 ... -
错误代码651[2022-02-06]
出现该错误时,进行重拨,就可以报告出新的具体错误代码 如果连LINK 灯都不亮,一直闪烁就是线路问题 ,电话报修 -
Eclipse启动错误代码= 1?(Eclipse startup Error code=1?)[2023-08-01]
Eclipse用于启动的JVM以某种方式C:\Windows\system32\javaw.exe 。 我不认为这是你打算用的。 要指定Eclipse使用的JVM,请将以下行添加到eclipse.ini文件中: -vm理想情况下,上述行必须存在于指定vmargs的行之前。 The JVM being used by Eclipse for startup is somehow C:\Windows\system32\ja ... -
返回错误代码(Returning Error Code)[2022-06-02]
exit , die和END块可以设置退出代码。 exit, die and END blocks can set the exit code.