02-23-2016 05:00 AM
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
02-25-2016 12:03 AM
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.
03-31-2016 10:16 AM
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.
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.