Question

I'm having a little trouble with Java RMI.

Am I able to check if a registry exists? This line of code is supposed to give me the registry.

LocateRegistry.getRegistry(ip, Registry.REGISTRY_PORT);

But when I call it with a wrong IP address or an IP address where no registry can be found, the method gets stuck.

So my question is, can i somehow check if there is a registry at a certain IP address BEFORE calling getRegistry()?

Was it helpful?

Solution

No. In any case the best way to test the availability of any resource is to try to use it. In this case, call lookup() and catch the exception. You have to do that anyway, so doing it twice is pretty pointless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top