package org.alfresco.repo.domain.locks; import org.alfresco.repo.lock.LockAcquisitionException; import org.alfresco.service.namespace.QName; /** * DAO services for alf_lock and related tables * * @author Derek Hulley * @since 3.2 */ public interface LockDAO { /** * Acquire a given exclusive lock, assigning it (and any implicitly shared locks) a * timeout. All shared locks are implicitly taken as well. *
* A lock can be re-taken if it has expired and if the lock token has not changed
*
* @param lockQName the unique name of the lock to acquire
* @param lockToken the potential lock token (max 36 chars)
* @param timeToLive the time (in milliseconds) that the lock must remain
*
* @throws LockAcquisitionException on failure
*/
void getLock(QName lockQName, String lockToken, long timeToLive);
/**
* Refresh a held lock. This is successful if the lock in question still exists
* and if the lock token has not changed. Lock expiry does not prevent the lock
* from being refreshed.
*
* @param lockQName the unique name of the lock to update
* @param lockToken the lock token for the lock held
* @param timeToLive the new time to live (in milliseconds)
*
* @throws LockAcquisitionException on failure
*/
void refreshLock(QName lockQName, String lockToken, long timeToLive);
/**
* Release a lock. The lock token must still apply and all the shared and exclusive
* locks need to still be present, unless the method is optimistic, in which case the
* unlock is considered to be a success.
* Lock expiration does not prevent this operation from succeeding.
*