• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI Registry

 
GD Deepz
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

Does not anyone have a solution how to determine if a registry is running a specific host and port.

LocateRegistry.createRegistry(port) --- works
LocateRegistry.getRegistry(host, port) ---- does not tell me much

What I want to do is that if a user starts a registry on a specific host and port and if another user want to start a registry on the SAME host and port, I want to bypass the the creation of the remote object and binding it to the registry.

Otherwise, I am going to get an AlreadyBoundExeption.

if (LocateRegistry.getRegistry(host, port)==null) --- should work but it does not
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
catch the exception. If you reach the catchblock the registry was already there, if not it wasn't
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!