cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster & CoreSession.setLock(…) [5.6]

Léa_____DÉCORNO
Champ in-the-making
Champ in-the-making

Hi,

I have two back-end servers on a single nuxeo-5.6 repository with concurrent scheduled import jobs running. To avoid concurrent document creation, I use a try {} catch {} block and set a document lock on a common parent document :

try {
 /* … */
 session.setLock(parentDocument.getRef());
 /* … */
 /* do multiple documents creation */
} finally {
 session.removeLock(parentDocument.getRef());
}

It did worked fine… until today, two concurrent document creation occurred.

So is CoreSession#setLock(DocumentRef ref) a good way of handling mutual exclusion between servers ? Is there a good (or more atomic) way of writing cluster-safe process ?

Cheers, Léa Raya DÉCORNOD

2 REPLIES 2

rg1_
Star Contributor
Star Contributor

The forthcoming Nuxeo State Manager, described in NXP-14553, will likely provide the ultimate solution to the issue you described. If you can't wait, you might consider adding a uniqueness constraint on specific columns in the hierarchy table as described in NXP-16912 and then writing some fairly low-level Java code to enforce unique pathSegments for children within a single Folderish document.

Florent_Guillau
World-Class Innovator
World-Class Innovator

This should work but 5.6 is a quite old Nuxeo version so we can't rule out locking bugs at this stage. Without a reproducible test case there's little hope to get to the bottom of this.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.