문제

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()?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top