Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question regarding LocateRegistry.createRegistry

843793Jun 8 2010 — edited Jun 10 2010
Hi all,

I have a problem with an application I did not develop but, unfortunately, have to support. The application is composed of five processes communicating to each other via RMI.
The initial registry is created as
rmi_registry = LocateRegistry.createRegistry(registryPort);
then all the processes register themselves on this registry
registry = LocateRegistry.getRegistry(host, registryPort);
registry.bind(own_rmi_name, this); 
In my test environment, all processes are running on the same machine. I have noticed that, when my ip address changes or I simply disconnect the network, I still have access to the registry, but the remote objects are given me with endpoint reference to the "old" ip address .
I tried, for sake of understanding, to get the registry in the second snippet with a loopback address
registry = LocateRegistry.getRegistry(InetAddress.getByName(null).getHostAddress(), registryPort);
registry.bind(own_rmi_name, this); 
but, when getting an instance of the remote object from a third process, the reference endpoint of the objects is still with the "wrong" ip address.

Looking at the perspective of the "watchdog" process, the question is : how can I be notified if the ip address changes ? And then, how do I tell all the processes that already have binded themselves to the registry, to rebind, provided the reference to the object points to the wrong ip address ?

TIA

Marco
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 8 2010
Added on Jun 8 2010
13 comments
960 views