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 RegDVDDatabase.java)…
…..the FactoryImpl() would be the only remote object registered.
4. The getRemote() in Max’s DVDConnector.java 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? Thanks, John
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! Regards, John
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