Package org.nuxeo.ecm.core.storage.sql
Class VCSLockManager
java.lang.Object
org.nuxeo.ecm.core.storage.sql.VCSLockManager
- All Implemented Interfaces:
LockManager
Manager of locks stored in the repository SQL database.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVCSLockManager(RepositoryImpl repository) Creates a lock manager for the given repository. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected LockdeleteLock(Serializable id, String owner) protected LockdeleteLock(Connection connection, Serializable id, String owner) protected voiddeleteLock0(Connection connection, Serializable id) protected ConnectionGets the lock on a document.protected SerializableidFromString(String id) protected LockreadLock(Serializable id) protected LockreadLock0(Connection connection, Serializable id) removeLock(String id, String owner) Removes the lock from a document.Sets a lock on a document.protected booleanDoes the exception mean that we should retry the transaction?protected booleantoString()protected LockwriteLock(Serializable id, Lock lock) protected LockwriteLock(Connection connection, Serializable id, Lock lock) protected voidwriteLock0(Connection connection, Serializable id, Lock lock) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.core.api.lock.LockManager
clearLockManagerCaches, closeLockManager
-
Field Details
-
LOCK_RETRIES
public static final int LOCK_RETRIES- See Also:
-
LOCK_SLEEP_DELAY
public static final long LOCK_SLEEP_DELAY- See Also:
-
LOCK_SLEEP_INCREMENT
public static final long LOCK_SLEEP_INCREMENT- See Also:
-
dataSourceName
-
model
-
sqlInfo
-
-
Constructor Details
-
VCSLockManager
Creates a lock manager for the given repository.LockManager.closeLockManager()must be called when done with the lock manager.- Since:
- 9.3
-
-
Method Details
-
getConnection
- Throws:
SQLException
-
idFromString
-
getLock
Description copied from interface:LockManagerGets the lock on a document.If the document does not exist,
nullis returned.- Specified by:
getLockin interfaceLockManager- Parameters:
id- the document id- Returns:
- the existing lock, or
nullwhen there is no lock
-
setLock
Description copied from interface:LockManagerSets a lock on a document.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).- Specified by:
setLockin interfaceLockManager- Parameters:
id- the document idlock- the lock to set- Returns:
nullif locking succeeded, or the existing lock if locking failed
-
checkConcurrentUpdate
-
shouldRetry
Does the exception mean that we should retry the transaction? -
shouldRetry
-
removeLock
Description copied from interface:LockManagerRemoves the lock from a document.The previous lock is returned.
If
ownerisnullthen the lock is unconditionally removed.If
owneris notnull, it must match the existing lock owner for the lock to be removed. If it doesn't match, the returned lock will returntrueforLock.getFailed().- Specified by:
removeLockin interfaceLockManager- Parameters:
id- the document idowner- the owner to check, ornullfor no check- Returns:
- the previous lock (may be
null), with a failed flag if locking failed
-
readLock
-
readLock0
- Throws:
SQLException
-
writeLock
-
writeLock
- Throws:
SQLException
-
writeLock0
- Throws:
SQLException
-
deleteLock
-
deleteLock
- Throws:
SQLException
-
deleteLock0
- Throws:
SQLException
-
toString
-