This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
1. I choose constructor which take charge of getting a reference of Data object(equals your DBMain).
2. Why call dataServeice.read()? Only check the validity！
3. I think you should scan other posts about how to lock in this forum before coding.
Joined: Mar 31, 2005
Hi Pan, the method signature of my lock() needs to throw RecordNotFoundException (sorry, I didn't remember to type it in the code of the previous post), thus I need to do a read to make sure that the record do exist before trying to insert the lock into the map.
I don't pass DBMain into the constructor since my DBMainImpl is specific for each client while the LogManager must be singleton - by passing it to the method, I can both check the validity and have a unique instance for locking purpose.
Not sure if the read() is what you meant by "validity"???