This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am a little bit confused about the validation of the record in the lock- method in Data class. I have used a Map lockedRecords where the record with the correspondent locked cookie is saved and my lock method looks like this:
Before the record will be locked, it should be checked if it is deleted or not in the database. But what is the correct time to check it: before the synchronisation block (1) or in this block (2). (1)