tjake/Solandra — pull request #161 by codingismy11to7 (2012-01-23 19:18:49+00:00)
Title: Deadlock fix

thread 1 gets lock on indexName, from getNextId, for instance
thread 2 calls synch'd getShardInfo method
thread 1 calls getShardInfo inside of indexName lock, blocks waiting
for thread 2 to finish
thread 2 hits the indexName lock inside of getShardInfo and deadlocks

traced all paths and made some lock changes:
- nextReservedId is only called from inside indexName lock, so no need
to lock it in that method
- almost all calls to getShardInfo were inside of an indexName lock, so
took out the indexName lock in that method
- added an indexName lock around the getShardInfo call inside of
getMaxId, for safety's sake