mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed LockDAO to use correct, new lock token during bulk update
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13954 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
<parameterMap id="parameter.ExclusiveLockUpdateMap" class="map">
|
||||
<parameter property="newLockToken" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="newStartTime" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="newExpiryTime" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="exclusiveLockResourceId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="oldLockToken" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
@@ -131,6 +132,7 @@
|
||||
set
|
||||
version = version + 1,
|
||||
lock_token = lower(?),
|
||||
start_time = ?,
|
||||
expiry_time = ?
|
||||
where
|
||||
excl_resource_id = ? and
|
||||
|
@@ -26,7 +26,6 @@ package org.alfresco.repo.domain.locks;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
@@ -145,9 +145,9 @@ public class LockDAOImpl extends AbstractLockDAOImpl
|
||||
updateLockEntity.setExclusiveResourceId(lockEntity.getExclusiveResourceId());
|
||||
updateLockEntity.setLockToken(lockToken);
|
||||
long now = System.currentTimeMillis();
|
||||
Long exp = now + timeToLive;
|
||||
updateLockEntity.setStartTime(lockEntity.getStartTime()); // Keep original start time
|
||||
updateLockEntity.setExpiryTime(exp); // Don't update the start time
|
||||
long exp = now + timeToLive;
|
||||
updateLockEntity.setStartTime(new Long(now));
|
||||
updateLockEntity.setExpiryTime(new Long(exp));
|
||||
template.update(UPDATE_LOCK, updateLockEntity, 1);
|
||||
// Done
|
||||
return updateLockEntity;
|
||||
@@ -163,10 +163,11 @@ public class LockDAOImpl extends AbstractLockDAOImpl
|
||||
Map<String, Object> params = new HashMap<String, Object>(11);
|
||||
params.put("exclusiveLockResourceId", exclusiveLockResourceId);
|
||||
params.put("oldLockToken", oldLockToken);
|
||||
params.put("newLockToken", oldLockToken);
|
||||
params.put("newLockToken", newLockToken);
|
||||
long now = System.currentTimeMillis();
|
||||
Long exp = new Long(now + timeToLive);
|
||||
params.put("newExpiryTime", exp);
|
||||
long exp = now + timeToLive;
|
||||
params.put("newStartTime", new Long(now));
|
||||
params.put("newExpiryTime", new Long(exp));
|
||||
int updateCount = template.update(UPDATE_EXCLUSIVE_LOCK, params);
|
||||
// Done
|
||||
return updateCount;
|
||||
|
Reference in New Issue
Block a user