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