Oks, this is a resume of my code:
First I create the folders with my own properties. I create various nodes calling this code:
<blockquote>
NodeRef nodeRef = getNodeService().createNode(parent, ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
QName.createQName(Constants.myModel, Constants.myDocumentType),
properties).getChildRef();
</blockquote>
When I finish, I update a document.
<blockquote>
writer = getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.putContent(inputStream);
</blockquote>
And then, I modify various properties, from the child node to the root calling recursively a method.
<blockquote>
private void modifyProperties(NodeRef nodeRef) {
Map<QName, Serializable> updateableProperties = changeProperties(…);
getNodeService().addProperties(nodeRef, updateableProperties);
NodeRef parent = getNodeService().getPrimaryParent(nodeRef).getParentRef();
if (!isRoot) {
modifyProperties(parent);
}
}
</blockquote>
I log all of this, and the createNode and putContent seems goes ok, because the createNode gives me a nodeRef. I log this nodeRef with a getPath and gives me a path with the new folder.
The "ConcurrencyFailureException: Failed to update node" is thrown when I do the getNodeService().addProperties. In this point, the exceptions appears. But appears sometimes. Doing the same, I delete the folders and test the same, and sometimes do all ok, and other times gives me the exception.
You can see something wrong? I don't know where is the error. Need more information?
Thanks again!