gaoran10 commented on code in PR #19708:
URL: https://github.com/apache/pulsar/pull/19708#discussion_r1129144070
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java:
##########
@@ -409,22 +413,23 @@ private static void
filterDomainsNotHavingLeastNumberAntiAffinityNamespaces(
return nsCount != null && nsCount != finalLeastNamespaceCount;
});
}
-
+ @FunctionalInterface
+ private interface CountAntiAffinityNamespaceOwnedBrokers{
+ void run(String broker, String namespace);
+ }
/**
* It returns map of broker and count of namespace that are belong to the
same anti-affinity group as given.
*
* @param pulsar
* @param namespaceName
- * @param brokerToNamespaceToBundleRange
+ * @param bundleOwnershipData
* @return
*/
public static CompletableFuture<Map<String, Integer>>
getAntiAffinityNamespaceOwnedBrokers(
final PulsarService pulsar, final String namespaceName,
- final ConcurrentOpenHashMap<String, ConcurrentOpenHashMap<String,
ConcurrentOpenHashSet<String>>>
- brokerToNamespaceToBundleRange) {
+ Object bundleOwnershipData) {
Review Comment:
It's confusing to add an Object type param. Actually, the method needs a
list of data pairs (broker -> namespace), the caller can filter invalid data,
and prepare the data first, maybe we need to create an interface that can
provide the list.
For `ModularLoadManagerImpl`, convert ConcurrentOpenHashMap to a List,
filter empty bundle ranges, then call this method.
For `ExtensibleLoadManagerImpl`, convert Set to a List, filter bundles with
an invalid state, then call this method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]