This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one 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"???