In Denny's DVD project, when one client starts, it does the following:
1. In GuiController , sample.remote.DvdConnector.getRemote(....) return a DBClient connection object.
1.1 Underneath the hood, there is a DvdDatabaserFactoryImpl that creates new DvdDatabaseImp();
(The code is in DvdConnector getRemote method)
1.2 Therefore DBClient connection refers to this DvdDatabaseImpl();
1.3 When the DvdDatabaseImp is created, it creates a new DvdDatabase() object;
(The code is in DvdDatabaseImpl constructor).
So, each client has its own connection and its own DvdDatabase object (facade).
Multiple clients will have multiple facade.
What happens if I modify the DvdConnector's getRemote method so that only one DvdDatabase object is used?
I use RmiNoFactoryExample as a reference
In this case, all clients will share the same DvdDatabaseRemote object, which is actually refering to a DvdDatabaseImp object, which
has a DvdDatabase.
In the other words, all clients will use the same DvdDatabase facade.
I think it is OK use to multiple clients to use multiple facade or multiple client to use a single facade because DvdDatabase has a singleton ReserveManager
that will do the locking.
In the exam, which approach I should go for? Multiple client, multiple facade ? Or, multiple client, single facade?