public interface LockManager
The method #close
must be called when done with the lock manager.
Modifier and Type | Method and Description |
---|---|
static boolean |
canLockBeRemoved(String oldOwner,
String owner)
Checks if a given lock can be removed by the given owner.
|
void |
clearLockManagerCaches()
Clears any cache held by the lock manager.
|
void |
closeLockManager()
Closes the lock manager and releases resources.
|
Lock |
getLock(String id)
Gets the lock on a document.
|
Lock |
removeLock(String id,
String owner)
Removes the lock from a document.
|
Lock |
setLock(String id,
Lock lock)
Sets a lock on a document.
|
Lock getLock(String id)
If the document does not exist, null
is returned.
id
- the document idnull
when there is no lockLock setLock(String id, Lock lock)
If the document is already locked, returns its existing lock status (there is no re-locking, removeLock(java.lang.String, java.lang.String)
must be called first).
id
- the document idlock
- the lock to setnull
if locking succeeded, or the existing lock if locking failedLock removeLock(String id, String owner)
The previous lock is returned.
If owner
is null
then the lock is unconditionally removed.
If owner
is not null
, it must match the existing lock owner for the lock to be removed. If it
doesn't match, the returned lock will return true
for Lock.getFailed()
.
id
- the document idthe
- owner to check, or null
for no checkforce
- true
to just do the remove and not return the previous locknull
), with a failed flag if locking failedstatic boolean canLockBeRemoved(String oldOwner, String owner)
oldOwner
- the existing lock's ownerowner
- the owner (may be null
)true
if the lock can be removedvoid closeLockManager()
void clearLockManagerCaches()
Copyright © 2017 Nuxeo. All rights reserved.