简体   繁体   English

如何在连接丢失时重新连接jconsole

[英]How to reconnect jconsole on connection lost

I am doing load test for my project, when i tried to use jconsole to monitor when the server is restarted connection is getting lost is there any solution for this? 我正在为我的项目进行负载测试,当我尝试使用jconsole来监控服务器何时重新启动连接丢失是否有任何解决方案?

Thanks 谢谢

jconsole connects to a process, when the server is restarted it gets a new process id, and jconsole did not know of the new process that is created. jconsole连接到进程,当服务器重新启动时,它获得一个新的进程ID,并且jconsole不知道创建的新进程。 There is no other but you have to connect it yourself. 没有别的,但你必须自己连接它。

Jconsole is connected to a process (jvm). Jconsole连接到进程(jvm)。 When your server is stop, the process doesn't exist anymore and so the jconsole connection is lost. 当您的服务器停止时,该进程不再存在,因此jconsole连接将丢失。 And so you have to connect jconsole to the new process created when you server is starting. 因此,您必须将jconsole连接到服务器启动时创建的新进程。

is there any solution for this? 这有什么解决方案吗?

One way to ease the pain is to use a JMX URL instead of a process ID. 缓解痛苦的一种方法是使用JMX URL而不是进程ID。 The JMX URL never changes on restart so while you have to reconnect anyway, at least the process is less painful. JMX URL在重新启动时永远不会改变,所以当你必须重新连接时,至少这个过程不那么痛苦。

URLs are of the format service:jmx:rmi:///jndi/rmi://hostName:portNum/jmxrmi . URL的格式为service:jmx:rmi:///jndi/rmi://hostName:portNum/jmxrmi Not sure what your server is, but here's how to enable it on tomcat . 不确定你的服务器是什么,但这里是如何在tomcat上启用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM