AnsweredAssumed Answered

Alfresco concurrency issue in clustered environment

Question asked by signjoy on Feb 28, 2017

We have two alfresco clusters running on two different nodes with two separate solr on each. 

 

Alfresco 5.1

Node A

Tomcat1:   Alfresco

                  Share

Tomcat2:  Solr

 

Node B:

Tomcat1:   Alfresco

                  Share

Tomcat2:  Solr

 

We have a content type called case and it will have one metadata called caseId which is nothing but a 8 digit number.

 

A third party application will send the documents via CMIS API. The third  party app uses AMQ to send requests to Alfresco via CMIS. Once the document comes into drop folder in alfresco, a onUpdate policy will be called and move the file to caseId folder. for example, if the case id is 12345678 then it will move the content to repository -> cases -> 12 -> 123 -> 12345 -> 12345678 folder. if any folder is not exists then it will create the folder. 

 

Issue:

The third party app puts all the CMIS calls in AMQ. if they put 10 CMIS calls in the Q for the same caseID (12345678) and they all come at the same time in alfresco it throws folder already exists exception. Because some calls are going to node A and some are going to node B. The both requests on the nodes trying to create the new case folder 12345678 (if not exists).

 

I've put the code to check if the folder exists or not before creating the folder, but the other node is not is getting false even though the node A has already created the folder. 

 

I tried to put the folder creation code in the synchronized block but it will work only when there is only one node is up.

 

Any help will be appreciated!

 

Thank you in advance...

Outcomes