0

Is there a way to determine the ip of the machine on which a remote object is hosted?Is there a way to get this information from the rmi registry?

Range
  • 649
  • 1
  • 7
  • 14

2 Answers2

1

You can access a rmiregistry only by using the IP it resides. And you can only call methods that are registered with the Remote interface. So writing a function in the interface to return an IP is of no use, I think.

itsraja
  • 1,566
  • 3
  • 26
  • 44
  • Hey ,nice idea!It works for me!I know the registry ip and I just need the ip of the machines that cary the remote objects!Thanks!You probably thought that I use a different registry for every object but no ,I have only one registry so this will work. – Range Feb 01 '11 at 06:43
0

There is no use you can possibly make of the information, so it isn't provided via an API. All you need to do with the stub is call remote methods with it.

user207421
  • 289,834
  • 37
  • 266
  • 440
  • imagine the call fails (IO Error for instance) but there are more spare machines (siblings) in a cluster that can potentially carry the request. Pick another avoiding the one the object is provided. Actually it's possible to obtain the IP from the LiveRef part but that's too much of implementation details. – bestsss Feb 07 '11 at 18:59
  • @bestsss: But having the IP address of the stub doesn't get you anywhere, because you can't *use* it. What you need in this instance is *another stub,* to a sibling: in other words some kind of load-balancing Registry. At this point I would be looking into CORBA via IIOP and a suitable vendor. – user207421 Feb 11 '11 at 06:11
  • I didn't mean that you *can* use the same, pick another one (from the set of the cluster) - another that is not provided by the same IP that just failed. – bestsss Feb 11 '11 at 06:20
  • @bestsss You can tell which stub failed *because it failed.* You don't need its IP address for that. Just object identity is sufficient. – user207421 Feb 13 '11 at 02:42
  • I mean to exlcude the server w/ that IP that failed from further calls. Not just the stub, you might have more exported objects. – bestsss Feb 13 '11 at 02:56