public class VCSLockManager extends AbstractLockManager
The public methods called by the session are setLock(java.lang.String, org.nuxeo.ecm.core.api.Lock)
, removeLock(java.lang.String, java.lang.String)
and getLock(java.lang.String)
. Method
#shutdown
must be called when done with the lock manager.
In cluster mode, changes are executed in a begin/commit so that tests/updates can be atomic.
Transaction management can be done by hand because we're dealing with a low-level Mapper
and not something
wrapped by a JCA pool.
Modifier and Type | Field and Description |
---|---|
static int |
LOCK_RETRIES |
static long |
LOCK_SLEEP_DELAY |
static long |
LOCK_SLEEP_INCREMENT |
Constructor and Description |
---|
VCSLockManager(String repositoryName)
Creates a lock manager for the given repository.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCaches()
Clears any cache held by the lock manager.
|
void |
close()
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.
|
String |
toString() |
canLockBeRemoved, canLockBeRemovedStatic
public static final int LOCK_RETRIES
public static final long LOCK_SLEEP_DELAY
public static final long LOCK_SLEEP_INCREMENT
public VCSLockManager(String repositoryName) throws StorageException
The mapper will from then on be only used and closed by the lock manager.
close()
must be called when done with the lock manager.
StorageException
public void close()
LockManager
public Lock getLock(String id)
LockManager
If the document does not exist, null
is returned.
id
- the document idnull
when there is no lockpublic Lock setLock(String id, Lock lock)
LockManager
If the document is already locked, returns its existing lock status (there is no re-locking, LockManager.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 failedpublic Lock removeLock(String id, String owner)
LockManager
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 idnull
), with a failed flag if locking failedpublic void clearCaches()
LockManager
Copyright © 2015 Nuxeo SA. All rights reserved.