ModeShape/modeshape — pull request #626 by rhauch (2012-12-17 17:05:45+00:00)
Title: MODE-1734 Corrected 'write-skew' error in Schematic

Added logic to explicitly lock the entry before a copy of the state is made. Infinispan only allows explicit locks to be used when PESSIMISTIC locking is enabled, and throws an exception (and rolls back the transaction) when OPTIMISITIC locking is enabled. Therefore, the locking is performed conditionally based upon the cache configuration, though it determined efficiently at startup of SchematicDb rather than each time a proxy is needed.

See [MODE-1734](https://issues.jboss.org/browse/MODE-1734) for much more detail about write-skew and why this solution works.

With these changes, the concurrent modification tests added in the previous commit(s) all pass.