Source:
<code>private void assignReplicasToThreads(Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate, int numberOfReplicaThreads, List<ReplicaThread> replicaThreadList, String threadIdentity) { if (numberOfReplicaThreads <= 0) { logger.warn("Number of replica threads is smaller or equal to 0, not starting any replica threads"); return; } <START> <END> if (replicasToReplicate.size() == 0) { logger.warn("Number of nodes to replicate from is 0, not starting any replica threads"); return; } else if (replicasToReplicate.size() < numberOfReplicaThreads) { logger.warn("Number of replica threads: is more than the number of nodes to replicate from: {}", numberOfReplicaThreads, replicasToReplicate.size()); numberOfReplicaThreads = replicasToReplicate.size(); } int numberOfNodesPerThread = replicasToReplicate.size() / numberOfReplicaThreads; int remainingNodes = replicasToReplicate.size() % numberOfReplicaThreads; Iterator<Map.Entry<DataNodeId, List<RemoteReplicaInfo>>> mapIterator = replicasToReplicate.entrySet().iterator(); for (int i = 0; i < numberOfReplicaThreads; i++) { Map<DataNodeId, List<RemoteReplicaInfo>> replicasForThread = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); int nodesAssignedToThread = 0; while (nodesAssignedToThread < numberOfNodesPerThread) { Map.Entry<DataNodeId, List<RemoteReplicaInfo>> mapEntry = mapIterator.next(); replicasForThread.put(mapEntry.getKey(), mapEntry.getValue()); mapIterator.remove(); nodesAssignedToThread++; } if (remainingNodes > 0) { Map.Entry<DataNodeId, List<RemoteReplicaInfo>> mapEntry = mapIterator.next(); replicasForThread.put(mapEntry.getKey(), mapEntry.getValue()); mapIterator.remove(); remainingNodes--; } ReplicaThread replicaThread = new ReplicaThread("Replica Thread-" + threadIdentity + "-" + i, replicasForThread, factory, clusterMap, correlationIdGenerator, dataNodeId, connectionPool, replicationConfig, replicationMetrics, notification, storeKeyFactory, replicationConfig.replicationValidateMessageStream, metricRegistry); replicaThreadList.add(replicaThread); } }</code><technical_language>line 491 a separate 'if' case consistent</technical_language>

Target:
private void assignReplicasToThreads(Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate, int numberOfReplicaThreads, List<ReplicaThread> replicaThreadList, String threadIdentity) { if (numberOfReplicaThreads == 0) { logger.warn("Number of replica threads is smaller or equal to 0, not starting any replica threads"); return; } if (replicasToReplicate.size() == 0) { logger.warn("Number of nodes to replicate from is 0, not starting any replica threads"); return; } if (replicasToReplicate.size() < numberOfReplicaThreads) { logger.warn("Number of replica threads: is more than the number of nodes to replicate from: {}", numberOfReplicaThreads, replicasToReplicate.size()); numberOfReplicaThreads = replicasToReplicate.size(); } int numberOfNodesPerThread = replicasToReplicate.size() / numberOfReplicaThreads; int remainingNodes = replicasToReplicate.size() % numberOfReplicaThreads; Iterator<Map.Entry<DataNodeId, List<RemoteReplicaInfo>>> mapIterator = replicasToReplicate.entrySet().iterator(); for (int i = 0; i < numberOfReplicaThreads; i++) { Map<DataNodeId, List<RemoteReplicaInfo>> replicasForThread = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); int nodesAssignedToThread = 0; while (nodesAssignedToThread < numberOfNodesPerThread) { Map.Entry<DataNodeId, List<RemoteReplicaInfo>> mapEntry = mapIterator.next(); replicasForThread.put(mapEntry.getKey(), mapEntry.getValue()); mapIterator.remove(); nodesAssignedToThread++; } if (remainingNodes > 0) { Map.Entry<DataNodeId, List<RemoteReplicaInfo>> mapEntry = mapIterator.next(); replicasForThread.put(mapEntry.getKey(), mapEntry.getValue()); mapIterator.remove(); remainingNodes--; } ReplicaThread replicaThread = new ReplicaThread("Replica Thread-" + threadIdentity + "-" + i, replicasForThread, factory, clusterMap, correlationIdGenerator, dataNodeId, connectionPool, replicationConfig, replicationMetrics, notification, storeKeyFactory, replicationConfig.replicationValidateMessageStream, metricRegistry); replicaThreadList.add(replicaThread); } }