Remove synchronization in long-running PCRS

Patch by Oleg Kibirev, reviewed by brandonwilliams for CASSANDRA-5456
This commit is contained in:
Brandon Williams 2013-04-12 12:11:30 -05:00
parent feae9efa42
commit d2eadba2a6
1 changed files with 5 additions and 3 deletions

View File

@ -38,6 +38,7 @@ import java.net.InetAddress;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.LinkedHashMap;
import java.util.concurrent.*;
@ -153,8 +154,10 @@ public class PendingRangeCalculatorService extends PendingRangeCalculatorService
// For each of the bootstrapping nodes, simply add and remove them one by one to
// allLeftMetadata and check in between what their ranges would be.
synchronized (bootstrapTokens)
{
synchronized(bootstrapTokens) {
bootstrapTokens = new LinkedHashMap<Token, InetAddress>(bootstrapTokens);
}
for (Map.Entry<Token, InetAddress> entry : bootstrapTokens.entrySet())
{
InetAddress endpoint = entry.getValue();
@ -164,7 +167,6 @@ public class PendingRangeCalculatorService extends PendingRangeCalculatorService
pendingRanges.put(range, endpoint);
allLeftMetadata.removeEndpoint(endpoint);
}
}
// At this stage pendingRanges has been updated according to leaving and bootstrapping nodes.
// We can now finish the calculation by checking moving nodes.