I am not sure about what to do here.
In the sequence lock->operation->unlock, if I delete a record, should I remove the lock?
We already discuss this issue before, I know, but I see we have two sides: one that defends the automatic unlock, and other that not.
I know there are motivation for both and I agree with both sides, that's my conflict...
option a) For example, a big argument for the automatic delete:
- Does not make sense to delete a record that does not exist.
option b) And a big one for the other case:
- You break the sequence lock->unlock->operation if you unlock the record inside the delete method, and the client should have to know to wich operation he need to call unlock... for some he needs, and for others not.
I first implemented using the option a, and changed to option b, but, at some time, I have a problem in the client side code: if I call delete method, and it return an exception, should I call unlock or not? In this case, I don't really know if the delete already unlocked the record before the exception... and again, I am thinking about option a...
I am in a conflict. Do someone have a very good argument for one side?