Fix for ALF-20185 - BM-0013: dashboard.xml already exists ERRORS in log file.

- ADMRemoteStore now allows a WRITE to be converted to an UPDATE to avoid terrifying FileExistsException exceptions in the log.
 - Reproduced original issue with a JMeter test that creates a single user, and then that same user performs 10 simultaneous login attempts with 10 threads
 - Message no longer appears in log running same JMeter test after changes.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56261 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2013-10-02 15:08:35 +00:00
parent 1d85a91e92
commit 3e148f0b29

View File

@@ -466,9 +466,14 @@ public class ADMRemoteStore extends BaseRemoteStore
behaviourFilter.disableBehaviour(parentFolderRef, ContentModel.ASPECT_AUDITABLE);
try
{
final String name = encpath.substring(off + 1);
// existence check - convert to an UPDATE - could occur if multiple threads request
// a write to the same document - a valid possibility but rare
if (nodeService.getChildByName(parentFolderRef, ContentModel.ASSOC_CONTAINS, name) == null)
{
FileInfo fileInfo = fileFolderService.create(
parentFolderRef, encpath.substring(off + 1), ContentModel.TYPE_CONTENT);
parentFolderRef, name, ContentModel.TYPE_CONTENT);
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1, 1.0f);
aspectProperties.put(ContentModel.PROP_IS_INDEXED, false);
unprotNodeService.addAspect(fileInfo.getNodeRef(), ContentModel.ASPECT_INDEX_CONTROL, aspectProperties);
@@ -479,6 +484,18 @@ public class ADMRemoteStore extends BaseRemoteStore
if (logger.isDebugEnabled())
logger.debug("createDocument: " + fileInfo.toString());
}
else
{
ContentWriter writer = contentService.getWriter(
nodeService.getChildByName(parentFolderRef, ContentModel.ASSOC_CONTAINS, name),
ContentModel.PROP_CONTENT,
true);
writer.guessMimetype(name);
writer.putContent(content);
if (logger.isDebugEnabled())
logger.debug("createDocument (updated): " + name);
}
}
finally
{
behaviourFilter.enableBehaviour(parentFolderRef, ContentModel.ASPECT_AUDITABLE);