Skip to content

Commit

Permalink
Fix typo for LoadManagerShared#filterAntiAffinityGroupOwnedBrokers (#…
Browse files Browse the repository at this point in the history
…12544)

### Motivation
Fix typo for LoadManagerShared#filterAntiAffinityGroupOwnedBrokers.

### Modifications
Fix typo for LoadManagerShared#filterAntiAffinityGroupOwnedBrokers.
  • Loading branch information
tomscut authored Nov 2, 2021
1 parent a75a974 commit 8242c9f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,29 +334,29 @@ public static void filterAntiAffinityGroupOwnedBrokers(
// now, "candidates" has list of brokers which are part of domain that can accept this namespace. now,
// with in these domains, remove brokers which don't have least number of namespaces. so, brokers with least
// number of namespace can be selected
int leastNamaespaceCount = Integer.MAX_VALUE;
int leastNamespaceCount = Integer.MAX_VALUE;
for (final String broker : candidates) {
if (brokerToAntiAffinityNamespaceCount.containsKey(broker)) {
Integer namespaceCount = brokerToAntiAffinityNamespaceCount.get(broker);
if (namespaceCount == null) {
// Assume that when the namespace is absent, there are no namespace assigned to
// that broker.
leastNamaespaceCount = 0;
leastNamespaceCount = 0;
break;
}
leastNamaespaceCount = Math.min(leastNamaespaceCount, namespaceCount);
leastNamespaceCount = Math.min(leastNamespaceCount, namespaceCount);
} else {
// Assume non-present brokers have 0 bundles.
leastNamaespaceCount = 0;
leastNamespaceCount = 0;
break;
}
}
// filter out broker based on namespace distribution
if (leastNamaespaceCount == 0) {
if (leastNamespaceCount == 0) {
candidates.removeIf(broker -> brokerToAntiAffinityNamespaceCount.containsKey(broker)
&& brokerToAntiAffinityNamespaceCount.get(broker) > 0);
} else {
final int finalLeastNamespaceCount = leastNamaespaceCount;
final int finalLeastNamespaceCount = leastNamespaceCount;
candidates
.removeIf(broker -> brokerToAntiAffinityNamespaceCount.get(broker) != finalLeastNamespaceCount);
}
Expand Down

0 comments on commit 8242c9f

Please sign in to comment.