• Post Reply Bookmark Topic Watch Topic
  • New Topic

RMIRegistry  RSS feed

 
Dilip kumar
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is this syntax for running RMIregistry correct ?
int port = 1099;
if(args.length > 0) port = (new Integer(args[0])).intValue();
try {
java.rmi.registry.LocateRegistry.createRegistry(port);
Naming.rebind("Data", new Data("db.db"));
System.out.println(" Data Server is ready");
}
catch (Exception e) {
System.out.println("Data Server failed :" + e);
}
Somewhere I have seen code like this:
Registry r = LocateRegistry.createRegistry(port);
r.bind("SearchCenter", new SearchServerImp());
I'm wondering what could be the difference.
Thanks
 
amit shukla
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use Naming.rebind() just to unbind any object bound with the same name so this is recommended. All other is same..

[This message has been edited by amit shukla (edited March 20, 2001).]
 
asad ali
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, when binding, use the full url.
e.g. Naming.rebind("Hostname ortNumber/Data", new Data());
This is important if you start your rmiregistry in a port other than 1099.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!