Frage

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)

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top