And also, your delete method must use the locking mechanism as well as your update method (note the comments of the lock method in the interface that was provided to you; it says that it locks a record so it can be updated or deleted).
SCJP 1.4 100%
SCJD 99.5%
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Bob, I'm very grateful for your explanation 'cause I would not have done the "is-record-correctly-locked" check in my delete, update etc. methods - I just did not think of this and would have blindly trusted the caller...
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
but after I got some deadlocks, I came to this conclusion
By using the locking mechanism, I meant that, before updating or deleting a record, you have to make sure that the client that is going to perform such operation owns the lock of that particular record.
John<br />SCJP 5, 97%
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
John<br />SCJP 5, 97%
OCPJP 6, OCMJD
SCJP, SCWCD, SCJD
OCPJP 6, OCMJD
Don't get me started about those stupid light bulbs. |