refactoring

pull/3696/head
Nikita Koksharov 4 years ago
parent 4acdf567d7
commit a155dde743

@ -661,10 +661,8 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
Set<ClusterPartition> clusterLastPartitions = getLastPartitions();
// https://github.com/redisson/redisson/issues/3635
Map<String, MasterSlaveEntry> nodeEntry = new HashMap<>();
clusterLastPartitions.forEach(partition -> {
nodeEntry.put(partition.getNodeId(), getEntry(partition.slots().nextSetBit(0)));
});
Map<String, MasterSlaveEntry> nodeEntries = clusterLastPartitions.stream().collect(Collectors.toMap(p -> p.getNodeId(),
p -> getEntry(p.slots().nextSetBit(0))));
Set<Integer> changedSlots = new HashSet<>();
for (ClusterPartition currentPartition : clusterLastPartitions) {
@ -674,7 +672,7 @@ public class ClusterConnectionManager extends MasterSlaveConnectionManager {
continue;
}
MasterSlaveEntry entry = nodeEntry.get(nodeId);
MasterSlaveEntry entry = nodeEntries.get(nodeId);
BitSet addedSlots = newPartition.copySlots();
addedSlots.andNot(currentPartition.slots());
currentPartition.addSlots(addedSlots);

Loading…
Cancel
Save