This is my first post, and firstly I just want to think Roel, Roberto, and Andrew for their consistently high caliber of replies. It has made working on this OCMJD project so much less daunting.
I am currently working on the Data class, and thinking about the the locking. I have tried searching through for the forums relating to multiple record locking etc., but I have not seen any topic cover the subject of a client trying to lock the same record multiple times.
Now for assignments which do not have a lock cookie its implied that the locking mechanism is aware of which client is locking the record, so it could easily detect multiple lock attempts on the same record and just return from the lock() method call. But my assignment has a lock cookie, which doesn't at first glimpse require me to track the client who locked the record as I can rely on them to pass the lock cookie when they are updating / deleting etc. If a single thread attempted calling lock on the same record multiple times, on locking code which was unaware of the calling client then it would deadlock waiting for the record to be released which would never happen.
My question is:
a) Should I handle this situation? Which would require my code to be aware of which client is attempting the lock.
b) and if I don't handle it, I can add this requirement to the Data Javadoc stating that the client must only lock one record at a time, and not make multiple attempts to lock the same record once the lock has been obtained?
I suppose if I should handle this situation, then the locking code needs to become aware of the locking cookie, and of which client is trying to get the lock.
Any thoughts would be much appreciated