首页 \ 问答 \ 如何在Java中为线程池的线程命名[复制](How to name the threads of a thread pool in Java [duplicate])

如何在Java中为线程池的线程命名[复制](How to name the threads of a thread pool in Java [duplicate])

这个问题在这里已经有了答案:

我有一个使用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 this protected 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
更新时间:2024-01-05 07:01

最新回答

首先,确认你安装用户是administrator。
其次,这是orale控制台错误,没什么大不了的,不用它oracle也能用。查看下数据库是否能正常启动登录。实在不行,重建一下控制台

相关问答

更多
  • 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 ...
  • 你是用IP地址后带phpmyadmin访问的吧?这个主要是域名或者IP地址没有被服务器信任导致,你可以将phpmyadmin整个目录移到网站根目录下,再用“网站域名/phpmyadmin”登陆进去;或者修改Apache/Nginx环境下的配置文件,一般是httpd.conf或者nginx.conf,然后找到Allow from 127.0.0.1 换成Allow from all即可
  • 是网站管理员关闭或禁止访问指定页面而导致的。403错误,是网站访问过程中,常见的错误提示。 错误代码:403.1–执行访问被禁止 下面是导致此错误信息的两个常见原因: 1、您没有足够的执行许可 例如,如果试图访问的ASP页所在的目录权限设为“无”,或者,试图执行的CGI脚本所在的目录权限为“只允许脚本”,将出现此错误信息。若要修改执行权限,请在Microsoft管理控制台(MMC)中右击目录,然后依次单击属性和目录选项卡,确保为试图访问的内容设置适当的执行权限。 2、您没有将试图执行的文件类型的脚本映射设置 ...
  • 具体的错误信息如何的。 看来是账号没权限访问目录。 最好是将tomcat安装到D:\apache-tomcat-7这样的目录,并设置权限、允许服务启动使用的账号完全访问整个目录
  • 开始-运行-CMD-输出netsh winsock reset回车, 重启电脑,即可。
  • 解决方法:在 Windows 中恢复系统/启动驱动器的驱动器号。 概要 警告:在驱动器号未更改的计算机中,不要使用本文介绍的过程。否则,可能无法启动操作系统。仅当需要从驱动器号更改中恢复时才执行本文中描述的过程,而不能使用该过程来更改现有的计算机驱动器。进行此更改之前,请先备份注册表项。 有关更多信息,请单击下面的文章编号,以查看 Microsoft 知识库中相应的文章: 249321 (http://support.microsoft.com/kb/249321/) 如启动分区驱动器号已更改则无法登录 本 ...
  • 这是从百度上下载的,看看: 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用于启动的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 ...
  • exit , die和END块可以设置退出代码。 exit, die and END blocks can set the exit code.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)