JMX Port动态分配 [英] JMX Port dynamic allocation

查看:102
本文介绍了JMX Port动态分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有16个Java进程,它们在一台计算机上运行的主要方法和参数相同.我希望通过JConsole远程监视这些内容.

I have 16 Java processes with the same main method and arguments running on one machine. I wish to monitor these remotely thru JConsole.

-Dcom.sun.management.jmxremote.port=5000这样的硬编码端口号将无法使用,因为这些进程使用相同的配置,并且它们不能在相同的端口上使用.

Hard coding port numbers like -Dcom.sun.management.jmxremote.port=5000 won't work because these processes are using same configuration and they can't work with same port.

JVM是否可以为16个进程中的每一个动态选择不同的端口?

Is it possible for the JVM to select a different port dynamically for each of the 16 processes?

推荐答案

使用RMI连接器可能是您指定代理URL的方式.

Using RMI Connector might be the way as you may specify URL of your agent.

如果需要,可以使用以下方法以编程方式创建RMI注册表:

In case you'd need it, you may create RMI registry programatically using:

java.rmi.registry.LocateRegistry.createRegistry(port);

您可能会发现以下无关的示例很有用:使用JMX通过防火墙连接

You may find following unrelated sample useful: Connecting Through Firewall Using JMX

这篇关于JMX Port动态分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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