• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI Naming and registry

 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to RMI;What is the difference between the Registry and naming services for lookup?
I see examples that do:

Registry registry = LocateRegistry.getRegistry(RemoteInterface.REGISTRY_PORT);
RemoteInterface remoteReference =
(RemoteInterface) UnicastRemoteObject.exportObject(new Server());
registry.rebind(RemoteInterface.REGISTRY_NAME, remoteReference);

as well as examples that do :
AccountImpl acct = new AccountImpl("JimF");

// Register it with the local naming registry
Naming.rebind("JimF", acct);

So what's the difference in binding to registry and naming service.I understand that both of them refer to the Registry in any case.
 
Edward Harned
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cross post:
http://forum.java.sun.com/thread.jspa?threadID=5119325&tstart=0
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the first case, this means that your server class programatically starts a new instance of the naming service/registry on the ip,port,etc. specified, and binds itself to it. When your server class shuts down, so does the naming service.

In the second case, your server class binds itself to the naming service/registry already running on the specified ip,port,etc. This registry could have been started from another program or the command line - but it is independent of your server class and doesn't shutdown if your server does.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic