ModeShape/modeshape — pull request #708 by hchiorean (2013-02-22 13:01:49+00:00)
Title: MODE-1821 - Fixed the inconsistency which can occur when creating SNS simultaneously from multiple threads. 

The solution was to add an additional method to JcrSession#PreSave and which is executed only after Infinispan locks are obtained on the changed nodes. For this to work however, Infinispan must be configured in PESIMISTIC mode.

In working this, another problem showed up: stale information (nodes) leaking from the workspace cache, which is shared among all sessions of a WS. To work around this, the solution was to always purge the workspace cache after locks are obtained.

This PR should be merged in 3.1.x and cherry-picked in master.