Hi Gytis
Originally posted by Gytis Jakutonis:
Hello,
in many posts I see the following implementation style:
I'm sure that many developers use this style not only in lock, but in delete(), update() etc. But I'm not sure about this issue:
As the result caller gets RecordNotLockedException(or no exception - depends on implementation style). But the record is already deleted, so RecordNotFoundException had to be thrown.
Possible solutions: lock entire database, lock concrete record, leave as is. Any comments?
I think & remember the sequence you mentioned is followed in
lock method and not in
unlock. The reason is we check if record is valid or not first in lock and if record is valid, we check if record is locked or not. If record is locked, wait for lock to release. If record is not valid, throw RNFE. So the sequence should be followed in lock method.
If your sequence is correct, I am not sure of why there is check for isLocked or isValid in unlock?
GoodLuck.