fcrepo/fcrepo — pull request #9 by damkjaer (2012-11-12 14:08:00+00:00)
Title: Fcrepo 1024

This is a fix to fcrepo-1024.

The fix moves the call to getWriteLock up before the check on objectExists. This way only one thread can be inside the part doing object creation without the need for an explicit synchronized statement.

In this fix I have introduced a StringLock in order to ensure that if two threads with the same PID ar to being created concurrently, then the second thread reaching getWriteLock will wait until the first thread has finished.
This will ensure, that if e.g. the first thread contains invalid xml, then the second thread will complete (if it is valid), because it waits on the first thread.