• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NX: Please Help! - Naming.rebind and Port

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Max's code and info from some other posts I am trying to
start a user specified port (XXXX = any port) using:
java.rmi.registry.LocateRegistry.createRegistry(XXXX);
and then I make the call:
RecDatabaseImpl aRec = new RecDatabaseImpl();
Naming.rebind("RecMediator", aRec);
My question is how does the Naming.rebind("RecMediator",aRec) recognize
the port XXXX???
By simply calling java.rmi.registry.LocateRegistry.createRegistry(XXXX)?
I dont understand how the two calls automatically tie into eachother becuase
the Registry object returned by LocateRegistry.createRegistry(XXXX) is
never used. Instead the code simply moves on and calls
Naming.rebind("RecMediator", aRec);
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill
Max's code starts the RMI Registry on the "well known" port: 1099. The rebind is just using that well known port. It would not work if you used any other port.
This would be a good time for you to visit the Naming API - this will explain how you can specify the port number in the name that you use as a parameter to bind(), rebind(), lookup() ....
I suggest you look at that reference first, then come back with any questions after that.
By the way, the LocateRegistry.createRegistry() method returns a reference to the registry that is started, so you could call rebind() on that reference and then you would not need the port number either.
Regards, Andrew
 
Bill Robertson
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Andrew, I should have done more homework on this.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic