mattisonchao commented on code in PR #15280:
URL: https://github.com/apache/pulsar/pull/15280#discussion_r858305990
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java:
##########
@@ -731,16 +731,21 @@ public CompletableFuture<Boolean>
isNamespaceBundleOwned(NamespaceBundle bundle)
return
pulsar.getLocalMetadataStore().exists(ServiceUnitUtils.path(bundle));
}
- public Map<String, NamespaceOwnershipStatus> getOwnedNameSpacesStatus()
throws Exception {
- NamespaceIsolationPolicies nsIsolationPolicies =
this.getLocalNamespaceIsolationPolicies();
- Map<String, NamespaceOwnershipStatus> ownedNsStatus = new
HashMap<String, NamespaceOwnershipStatus>();
- for (OwnedBundle nsObj :
this.ownershipCache.getOwnedBundles().values()) {
- NamespaceOwnershipStatus nsStatus =
this.getNamespaceOwnershipStatus(nsObj,
-
nsIsolationPolicies.getPolicyByNamespace(nsObj.getNamespaceBundle().getNamespaceObject()));
- ownedNsStatus.put(nsObj.getNamespaceBundle().toString(), nsStatus);
- }
-
- return ownedNsStatus;
+ public CompletableFuture<Map<String, NamespaceOwnershipStatus>>
getOwnedNameSpacesStatusAsync() {
+ return getLocalNamespaceIsolationPoliciesAsync()
+ .thenCompose(namespaceIsolationPolicies -> {
+ List<CompletableFuture<OwnedBundle>> ownedBundleFutures =
Collections.unmodifiableList(
+ new
ArrayList<>(ownershipCache.getOwnedBundlesAsync().values()));
+ return FutureUtil.waitForAll(ownedBundleFutures)
Review Comment:
fixed
--
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]