• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:RMI Easy Question

 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me how and when the RMI System creates a new instance of DatabaseImpl on the Server side. Max's book seems to create a DatabaseImpl on the client side and binds it to a name, then uses the naming lookup sevice to get a reference to this object on the server???
Am I right in saying the DVDAdapter is not created on the client but on the server when the naming service is used ?
Tony
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating an instance on the server isn't about the Naming Service.
The naming service is like a directory structure. It can hold objects and other information. So if you bind an object into the registry, it is already a created instance.
Now you can have two different kind of objects resiing on the server. One that would be bound to the registry, and one that is just a Remote object that the Remote JVM handles and is not bound to the registry.
So in you server code you will create the instance of the DataImpl class and then bind that instance to the registry.
But better yet, you will have a ConnectionFactory that instantiated in the server code and passed a reference to the instance of the DataImpl. This factory is what is looked up by the client. You then call a method like getConnection(). This will create a new instance of a Connection Object, that will act as a Remote object uniquely for the client. It will be a one to one relationship between a client and the server.
Good Luck and I hope that helps answer your question.
Mark
 
Tony Collins
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh sorry, Max's book confused me as the Server and client were on the same JVM.
Tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic