Hi guys,
first of all thanks for reading my question!
I have a problem with concurrent insertion of documents using nodes api:
/nodes/{nodeId}/children?autoRename=true
It returns 409 when i try inserting 5 documents with the same name concurrently.
Can you please help me avoid 409 error.
Thanks for reading, I would apreciate any idea that leads to solution.
Solved! Go to Solution.
I solved the problem by synchronizing insert calls. See code below:
private static Object lockingObjectInsert = new Object();
private Response<NodeRepresentation> insertSynchronized(Document documentEntity,NodeBodyCreate documentBody) throws IOException { synchronized (lockingObjectInsert) { Response<NodeRepresentation> responseCreate = getNodesAPI().createNodeCall(getFolderId(documentEntity), documentBody,true,null,null).execute(); return responseCreate; } }
I solved the problem by synchronizing insert calls. See code below:
private static Object lockingObjectInsert = new Object();
private Response<NodeRepresentation> insertSynchronized(Document documentEntity,NodeBodyCreate documentBody) throws IOException { synchronized (lockingObjectInsert) { Response<NodeRepresentation> responseCreate = getNodesAPI().createNodeCall(getFolderId(documentEntity), documentBody,true,null,null).execute(); return responseCreate; } }
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.