I use the -Djava.rmi.server.hostname=localhost option to make rmi listen on localhost only, but netstat shows the socket is listening on 0.0.0.0.
The strange thing is that the RMI RenewClean thread shows its using localhost. E.g. RMI RenewClean-[localhost:59357]
I assumed that if I set -Djava.rmi.server.hostname=localhost it should only be listening on 127.0.0.1
Am I misunderstanding what java.rmi.server.hostname controls?
No.
Yes.
java.rmi.server.hostnamehas nothing whatsoever to do with what IP address the remote object listens on. That is determined by theRMIServerSocketFactory.To correct the misquotation from my book in another answer (subsequently deleted):
To expand on that, it can also be used to control the effective IP address (as seen by clients) of RMI servers exported by hosts that are behind NAT devices. It doesn’t necessarily have anything to do with the local host, e.g. in NAT situations, and it can be either a hostname, a dotted-quad IPv4 address, or an IPv6 address.
[1] Pitt & McNiff, java.rmi, The Remote Method Invocation Guide, Addison Wesley 2001, p.258.