infinispan/infinispan — pull request #1342 by danberindei (2012-09-26 11:01:36+00:00)
Title: ISPN-2316 Distributed deadlock in StateTransferInterceptor

https://issues.jboss.org/browse/ISPN-2316

Reorganize the StateTransferLock:
* Remove the transactions lock and the commands lock.
* Split waitForTopology() into waitForTopology() and waitForTransactionData()
* Introduce a new read-write topology lock to replace the commands lock.

It's ok to remove the transactions lock because any transaction
modification (after the transactions table snapshot was taken)
is guaranteed to be forwarded to the new owners.

waitForTopology() is now used only to ensure that when joiners start requesting
state, every other node already knows about them.

waitForTransactionData() is used to block commands until the local node
has received transaction data for all the new segments.

The new read-write topology lock is held exclusively during topology changes
and non-exclusively during commits to the data container - so that data not
owned by the local node is not written to the data container.