• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

RMI: Creation of Remote Objects??  RSS feed

 
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!