-
Bug
-
Resolution: Unresolved
-
Major
-
2.1.1
-
None
-
None
-
3 - For the record
-
2 - Normal
The AmetysObject lock API (LockableAmetysObject + LockAwareAmetysObject) and implementation aren't coherent:
if (lockableObject.isLocked())
{
lockableObject.unlock();
}
A LockableAmetysObject can return true when object.isLocked() is called, and still throw an exception when calling object.unlock(), when the object's parent is locked: the underlying node is locked by its parent, but does not contain the lock token property.
The API should be clarified:
- unlock() should throw a specific exception, indicating the object is locked but could not be unlocked because the lock is on one of its ancestors.
- a new method should be added, like isLockedByAncestor(), or the isLocked() could return a three-state enumeration (unlocked, locked, locked by ancestor).
- Maybe a new method to indicate which object owns the lock ? Or a forceUnlock() method which removes the lock, wherever the lock is ?