• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LocateRegistry.getRegistry (1234);

 
Charlie Goth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LocateRegistry.getRegistry(1234);
I'm running this code which returns a Registry, is there an easy way of telling there is actually a registry running? I assumed it would return null if there isn't one on localhost port 1234. At the moment I'm having to call list() on the returned registry, using a thrown exception to indicate there's no registry bound on that port.
Thanks
Charlie
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Charlie, I think your question just answered a question that was posed in another post.
I think you've got about the only way to detect an actual registry. The docs essentially state that there is no way to know if you actually hook up to a real registry. You could streamline the process a little by going ahead and trying to rebind your server to the returned registry object and watching for an error from that. If it threw errors, just programatically start a new registry in the catch() section and do the same rebind process over again.
It should work pretty well.
Chris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic