infinispan/infinispan — pull request #753 by danberindei (2011-12-20 20:02:15+00:00)
Title: ISPN-1630 - KeyAffinityService's topology change listener can hang state transfer/cache view installation

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

Set an upper bound on the number of keys generated by KeyGeneratorWorker before releasing the maxNumberInvariant read lock.
When polling for a key, acquire the maxNumberInvariant read lock inside the loop.