Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

NX: Connection Factory for RMI

Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I just would like to check something regarding the creation of a connection factory which I intend to use in my implementation.
In Max’s book, as part of the RMI, he does not create a new DVDDatabase object for each client, instead the one instance is shared for all clients that connect to the server. If this implementation was to be changed to use a factory so that each client would receive a DVDDatabase object, would the following changes implement it – it is just a brief overview.
1. An interface e.g. Factory would be created which would extend Remote. A method something like getDVDDatabase() would be included to return a new DVDDatabase object, the method would throw a RemoteException.
2. A FactoryImpl would be created to implement Factory and it would extend UnicastRemoteObject.
3. Instead of registering the DVDDatabaseImpl as the remote object as Max does in his book (as shown below – taken from…

…..the FactoryImpl() would be the only remote object registered.

4. The getRemote() in Max’s would look something like as follows…

5. The stub files for the DVDDatabaseImpl and FactoryImpl would still have to be created as methods will be called from the client on both of these remotely.
Is this the general idea?
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello John
Take a look at the following thread:
Rmi question
Andrew has done a wonderful job of explaining the Connection Factory concept in the most basic terms.
author and jackaroo
Posts: 12199
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John
Yes, that is the general idea.
But you should be aware that there may be other issues with thread safety which may require changes to other classes from Max's design.
Regards, Andrew
John Canavan
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bharat and Andrew,
Thanks for your comments. I am going to have a look through some of the threads on creating the RMI connection factory, so I may have some questions depending on what I have read!
no wonder he is so sad, he hasn't seen this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic