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
-
Constructor Summary
ConstructorDescriptionVCSLockManager
(RepositoryImpl repository) Creates a lock manager for the given repository. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected Lock
deleteLock
(Serializable id, String owner) protected Lock
deleteLock
(Connection connection, Serializable id, String owner) protected void
deleteLock0
(Connection connection, Serializable id) protected Connection
Gets the lock on a document.protected Serializable
idFromString
(String id) protected Lock
readLock
(Serializable id) protected Lock
readLock0
(Connection connection, Serializable id) removeLock
(String id, String owner) Removes the lock from a document.Sets a lock on a document.protected boolean
Does the exception mean that we should retry the transaction?protected boolean
toString()
protected Lock
writeLock
(Serializable id, Lock lock) protected Lock
writeLock
(Connection connection, Serializable id, Lock lock) protected void
writeLock0
(Connection connection, Serializable id, Lock lock) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:LockManager
Gets the lock on a document.If the document does not exist,
null
is returned.- Specified by:
getLock
in interfaceLockManager
- Parameters:
id
- the document id- Returns:
- the existing lock, or
null
when there is no lock
-
setLock
Description copied from interface:LockManager
Sets 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:
setLock
in interfaceLockManager
- Parameters:
id
- the document idlock
- the lock to set- Returns:
null
if 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:LockManager
Removes the lock from a document.The previous lock is returned.
If
owner
isnull
then the lock is unconditionally removed.If
owner
is notnull
, it must match the existing lock owner for the lock to be removed. If it doesn't match, the returned lock will returntrue
forLock.getFailed()
.- Specified by:
removeLock
in interfaceLockManager
- Parameters:
id
- the document idowner
- the owner to check, ornull
for 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
-