aspose file tools*
The moose likes Distributed Java and the fly likes RMI Naming and registry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Naming and registry" Watch "RMI Naming and registry" New topic
Author

RMI Naming and registry

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
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

Joined: Sep 19, 2005
Posts: 291

cross post:
http://forum.java.sun.com/thread.jspa?threadID=5119325&tstart=0


Ed's latest article: A Java Parallel Calamity http://coopsoft.com/ar/Calamity2Article.html
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Naming and registry
 
Similar Threads
RMI and Eclispe Editor
Need to extend UnicastRemoteObject class
Not implementing the RemoteException
Applet AccessControlException as RMI client
How to create unique Client ID