mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Can't reproduce the bug but spotted a race condition in UserUsageTrackingComponent that may cause this in rare circumstances. Deal with this by throwing a ConcurrencyFailureException and let the txn retry handler retry the operation. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19862 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -504,7 +504,11 @@ public class ContentUsageImpl implements ContentUsageService,
|
||||
return (currentUsage == null ? -1 : currentUsage);
|
||||
}
|
||||
|
||||
public long getUserUsage(String userName)
|
||||
public long getUserUsage(String userName) {
|
||||
return getUserUsage(userName, false);
|
||||
}
|
||||
|
||||
public long getUserUsage(String userName, boolean removeDeltas)
|
||||
{
|
||||
ParameterCheck.mandatoryString("userName", userName);
|
||||
|
||||
@@ -518,9 +522,11 @@ public class ContentUsageImpl implements ContentUsageService,
|
||||
|
||||
if (currentUsage != -1)
|
||||
{
|
||||
// add any deltas
|
||||
currentUsage = currentUsage + usageService.getTotalDeltaSize(personNodeRef);
|
||||
|
||||
long deltaSize = removeDeltas ? usageService.getAndRemoveTotalDeltaSize(personNodeRef) :
|
||||
usageService.getTotalDeltaSize(personNodeRef);
|
||||
// add any deltas to the currentUsage, removing them if required
|
||||
currentUsage = currentUsage + deltaSize;
|
||||
|
||||
if (currentUsage < 0)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
|
Reference in New Issue
Block a user