More debugging level logging for tagging updates, to help identify the problem with periodic multi-threaded test failures on bamboo

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23283 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-10-26 14:41:06 +00:00
parent b0a43c462d
commit 45b5fb977b

View File

@@ -205,17 +205,26 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
transactionService.getRetryingTransactionHelper().doInTransaction( transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<Void>() { new RetryingTransactionCallback<Void>() {
public Void execute() throws Throwable { public Void execute() throws Throwable {
// Search // Search for updates
Map<String,Integer> updates = new HashMap<String, Integer>(); Map<String,Integer> updates = new HashMap<String, Integer>();
List<Long> entryIds = searchForUpdates(tagScope, updates); List<Long> entryIds = searchForUpdates(tagScope, updates);
// Log what we found
if(logger.isDebugEnabled()) if(logger.isDebugEnabled())
{ {
if(updates.size() > 0) if(updates.size() > 0)
{
logger.debug("Found updates for tag scope " + tagScope + " : " + updates); logger.debug("Found updates for tag scope " + tagScope + " : " + updates);
}
else if(updatesRemain.intValue() > 1)
{
logger.debug("All updates now processed for tag scope " + tagScope);
}
else else
{
logger.debug("No updates needed for tag scope " + tagScope); logger.debug("No updates needed for tag scope " + tagScope);
} }
}
// Does any work remain? // Does any work remain?
if(updates.size() == 0) if(updates.size() == 0)
@@ -223,6 +232,7 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
updatesRemain.setValue(0); updatesRemain.setValue(0);
return null; return null;
} }
updatesRemain.setValue(updatesRemain.intValue()+1);
// Update the tags // Update the tags
performUpdates(tagScope, updates); performUpdates(tagScope, updates);
@@ -245,7 +255,12 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
// We're done with this tag scope // We're done with this tag scope
unlockTagScope(tagScope, lock); unlockTagScope(tagScope, lock);
} catch(LockAcquisitionException e) {} } catch(LockAcquisitionException e) {
if(logger.isDebugEnabled())
{
logger.debug("Tag scope " + tagScope + " is already being processed by another action, skipping");
}
}
// Now proceed to the next tag scope // Now proceed to the next tag scope
} }
@@ -354,6 +369,7 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
{ {
tags = TaggingServiceImpl.readTagDetails(contentReader.getContentInputStream()); tags = TaggingServiceImpl.readTagDetails(contentReader.getContentInputStream());
} }
String previousTagState = tags.toString();
// Figure out what changes to make // Figure out what changes to make
for (String tagName : updates.keySet()) for (String tagName : updates.keySet())
@@ -412,6 +428,16 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
contentWriter.setEncoding("UTF-8"); contentWriter.setEncoding("UTF-8");
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
contentWriter.putContent(tagContent); contentWriter.putContent(tagContent);
// Log this if required
if(logger.isDebugEnabled())
{
logger.debug(
"Updated tag scope " + tagScopeNode + " with " + updates + ", " +
"new contents are { " + tagContent.replace("\n", " : ") + " } " +
"from old contents of " + previousTagState
);
}
} }
} }