Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

RMI: Creation of Remote Objects??

 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have trouble understanding the concept of creation of remote objects. Please help me in understanding, thanks.
I will try to ask showing the code from Max's book sample project. The first one is the class where we register the remote object to RMI registry.

The second class is the DVDConnector class.

In the getRemote() method DVDConnector class, we are returning DVDDatabaseImpl that is registered with the name DVDMediator(in RMI Registry) in the RegDVDDatabase class. Does this registering of object done for each remote client or is it done only once?
If its done only once then all remote clients have access to the same DVDDatabaseImpl object, right?
Or though registering is done only once, RMI serves each remote client with a different object of DVDDatabaseImpl class?
I know this is a fundamental question, but I could not understand it.
Appreciate your help, thanks.
[ February 19, 2004: Message edited by: Satish Avadhanam ]
 
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satish,


In the getRemote() method DVDConnector class, we are returning DVDDatabaseImpl that is registered with the name DVDMediator(in RMI Registry) in the RegDVDDatabase class. Does this registering of object done for each remote client or is it done only once?


The RMI server object itself is registered once, when it is bound into the registry via code like Naming.rebind("DVDMediator", aDVD).


If its done only once then all remote clients have access to the same DVDDatabaseImpl object, right?


Yes.


Or though registering is done only once, RMI serves each remote client with a different object of DVDDatabaseImpl class?


Each client has an object to work with that is local to its JVM. That object is an instance of the rmic generated RMI stub class. It acts as a proxy for the remote server object. Therefore, each client is working with the original server object, but only indirectly through the proxy.
I hope that clarifies things for you.
[ February 19, 2004: Message edited by: Ken Krebs ]
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ken, thanks man. Your explanation helped me in understanding.
Appreciate it, thanks.
 
New rule: no elephants at the chess tournament. Tiny ads are still okay.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic