Ken wrote (about his design):
The most important implementation of Services is the ServicesImpl class which is a singleton.
The ServicesImpl singleton is the only object that interacts with the Data singleton and hence the only direct user of the locking/unlocking API.
The Standalone application functionality gets its Services instance directly from ServicesImpl's static getServices method.
Now my question to Ken, or anybody is:
Are the methods of the ServicesImpl singleton synchronized? Because, if they are not, I see no need for a singleton here. At least not in my design.
My data class is already
thread safe, synchronized on the raf and the lock map. My version of the ServicesImpl class , DBClientImpl, just provide server side booking (lock, book, unlock), and find methods.
My RemoteDBClientImpl class delegates everything to DBClientImpl. But I don't see why DBClientImpl has to be a singleton. Surely each instance of my RemoteDBClientImpl can have it's own instance of DBClientImpl.
What am I missing? Or is my design different?