mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix ALF-11734: Concurrency conditions not handled correctly for ACL persistence
- Struggled to get reproducible test in code - If this doesn't fix the problem fully, then at least it'll push it up a level, however the higher caches already have pessimistic removal of entries, so should be OK - In the same way, this could fix ALF-11720: WCM: OrphanReaper contention throws error (3.4.x) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -258,6 +258,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int updated = aclEntityCache.updateValue(entity.getId(), entity);
|
||||
if (updated < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(entity.getId());
|
||||
throw new ConcurrencyFailureException("AclEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently");
|
||||
}
|
||||
}
|
||||
@@ -273,6 +274,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int deleted = aclEntityCache.deleteByKey(id);
|
||||
if (deleted < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(id);
|
||||
throw new ConcurrencyFailureException("AclEntity with ID " + id + " no longer exists");
|
||||
}
|
||||
}
|
||||
@@ -432,6 +434,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
|
||||
if (updated < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(entity.getId());
|
||||
throw new ConcurrencyFailureException("AclMemberEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently");
|
||||
}
|
||||
}
|
||||
@@ -514,6 +517,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int deleted = deleteAclChangeSetEntity(changeSetId);
|
||||
if (deleted != 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(changeSetId);
|
||||
throw new ConcurrencyFailureException("Deleted by ID should delete exactly 1: " + changeSetId);
|
||||
}
|
||||
}
|
||||
@@ -738,6 +742,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int updated = permissionEntityCache.updateValue(permission.getId(), permission);
|
||||
if (updated < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(permission.getId());
|
||||
throw new ConcurrencyFailureException("PermissionEntity with ID (" + permission.getId() + ") no longer exists or has been updated concurrently");
|
||||
}
|
||||
}
|
||||
@@ -754,6 +759,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int deleted = permissionEntityCache.deleteByKey(id);
|
||||
if (deleted < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(id);
|
||||
throw new ConcurrencyFailureException("PermissionEntity with ID " + id + " no longer exists");
|
||||
}
|
||||
}
|
||||
@@ -915,6 +921,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int updated = authorityEntityCache.updateValue(entity.getId(), entity);
|
||||
if (updated < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(entity.getId());
|
||||
throw new ConcurrencyFailureException("AuthorityEntity with ID (" + entity.getId() + ") no longer exists or has been updated concurrently");
|
||||
}
|
||||
}
|
||||
@@ -931,6 +938,7 @@ public abstract class AbstractAclCrudDAOImpl implements AclCrudDAO
|
||||
int deleted = authorityEntityCache.deleteByKey(id);
|
||||
if (deleted < 1)
|
||||
{
|
||||
aclEntityCache.removeByKey(id);
|
||||
throw new ConcurrencyFailureException("AuthorityEntity with ID " + id + " no longer exists");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user