JMX: rmiPort and registryPort too?

I am trying to learn JMX as deep as possible.

I read a lot of blog posts on how to explicitly set the port numbers used by the JMX server. As you know, two ports are actually required: one for the registry and one for the RMI protocol traffic. I recently discovered this blog post saying that the two ports can be installed the same, so you only need to punch one hole in the firewall. I have to admit, I thought it would never work. I was sure that this would throw a β€œsocket already bound” exception or something like that. But it works!

Questions:

  • Why does this work? Why can the registry work in the same port where rmi protocol traffic is used?

  • Given that this works, why would I want them to be on different ports. (assuming you always use Java7)

+2
source share
1 answer

All remote objects, including the registry, exported from the same JVM, can share the same port. This is the main function of RMI.

You would only like to use them on different ports if, for example, one used SSL and the other did not, or if they were in different JVMs

+3
source

All Articles