posted 18 years ago
The port will not be release until the application has exited. And that, my friend, cannot be changed, as far as I understand.
However, the registry will no longer accept method requests (like bind, list or lookup).
Likewise, after unexportObject, you can create another registry listening on the same port and there will be no problem, as long as you do it on the same JVM that originaly created the registry that you unexported.
The thing is, not other Socket in this or other JVM will accept connections to a port previously used by the RMIRegistry until you exit the application that created the registry.
The port number can be reused by the RMIRegistry after you have unexported the registry object, but it can never be reused for other purposes other than the RMIRegistry.
What is exactly what you need to do that you need to get that port back?