JMX : rmiPort and registryPort the same?

我是研究僧i 提交于 2019-12-23 17:13:54

问题


I'm trying to learn JMX as deep as possible.

I've read many blog posts about how to explicitly set the port numbers used by the JMX server. As you may be aware there are actually two ports required: One for the Registry and one for RMI protocol traffic. Recently I discovered this blog post which suggests that the two ports can be set to the same so that you only have to punch one hole in the firewall. I must admit I thought it would never work. I was certain that it would create a "socket already bound" exception or something like that. But it does work!

Questions:

  1. Why does it work? Why can the Registry live on the same port as is used rmi protocol traffic?

  2. Given that this works why would I ever want them to be on different ports. (assuming always using Java7 latest)


回答1:


All remote objects, including the Registry, exported from the same JVM can share the same port. This is a basic feature of RMI.

You would only want them on different ports if e.g. one used SSL and one didn't, or if they were in different JVMs



来源:https://stackoverflow.com/questions/21535066/jmx-rmiport-and-registryport-the-same

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!