Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)

73355: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      73281: Merged V4.1-BUG-FIX (4.1.10) to V4.2-BUG-FIX (4.2.3)
         73054 (REDO MERGE): Added LockDAO.releaseLockQuiet and used it for the callback's precautionary lock release
                - Fixes MNT-11507: JobLockService automatic refresh is triggering a retry under normal conditions
                - Prevents a DEBUG message from RetryingTransactionInterceptor when the normal condition is for
         	    the lock to no longer exist
         73279: Fix javadoc for JobLockService.releaseLock to include @throws
         This revision undoes the behaviour change of JobLockService.releaseLock introduced by:
           56164: Fixes ALF-19964: Breaking API change in JobLockService.releaseLock
         The JobLockService now behaves the same on 4.1.x and 4.2.x, while all bug fixes are preserved.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74773 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-06-25 15:59:34 +00:00
parent 0b5a6de25c
commit 133428c149
6 changed files with 23 additions and 68 deletions

View File

@@ -354,7 +354,7 @@ public class JobLockServiceImpl implements JobLockService
// Release the lock in case the initiator did not do it.
// We just want to release and don't care if the lock was already released
// or taken by another process
if (releaseLockQuiet(lockToken, lockQName))
if (releaseLockVerify(lockToken, lockQName))
{
// The callback must be informed as we released the lock automatically
callLockReleased(callback);
@@ -424,7 +424,14 @@ public class JobLockServiceImpl implements JobLockService
@Override
public void releaseLock(final String lockToken, final QName lockQName)
{
releaseLockVerify(lockToken, lockQName);
RetryingTransactionCallback<Boolean> releaseCallback = new RetryingTransactionCallback<Boolean>()
{
public Boolean execute() throws Throwable
{
return lockDAO.releaseLock(lockQName, lockToken, false);
}
};
retryingTransactionHelper.doInTransaction(releaseCallback, false, true);
}
/**
@@ -442,27 +449,6 @@ public class JobLockServiceImpl implements JobLockService
return retryingTransactionHelper.doInTransaction(releaseCallback, false, true);
}
/**
* Attempt to release a lock but do not worry about not being able to update the lock.
* If the lock was taken by another process, then it will not matter. Any other database-related
* conditions will still trigger a retry.
*
* @param lockToken the unique lock token to release (expired or not)
* @param lockQName the name of the lock
* @return <tt>true</tt> if the lock was released or <tt>false</tt> if not
*/
private boolean releaseLockQuiet(final String lockToken, final QName lockQName)
{
RetryingTransactionCallback<Boolean> releaseCallback = new RetryingTransactionCallback<Boolean>()
{
public Boolean execute() throws Throwable
{
return lockDAO.releaseLockQuiet(lockQName, lockToken);
}
};
return retryingTransactionHelper.doInTransaction(releaseCallback, false, true);
}
/**
* @throws LockAcquisitionException on failure
*/