wangjialing218 commented on a change in pull request #14702:
URL: https://github.com/apache/pulsar/pull/14702#discussion_r829649359
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
##########
@@ -89,7 +89,8 @@
public void getActiveBrokers(@Suspended final AsyncResponse asyncResponse,
@PathParam("cluster") String cluster) {
validateSuperUserAccessAsync()
- .thenCompose(__ -> validateClusterOwnershipAsync(cluster))
+ .thenCompose(__ -> cluster == null ?
CompletableFuture.completedFuture(null)
+ : validateClusterOwnershipAsync(cluster))
Review comment:
Yes, `validateClusterOwnershipAsync` could also pass when cluster=null
##########
File path:
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokersImpl.java
##########
@@ -42,14 +42,24 @@ public BrokersImpl(WebTarget web, Authentication auth, long
readTimeoutMs) {
adminBrokers = web.path("admin/v2/brokers");
}
+ @Override
+ public List<String> getActiveBrokers() throws PulsarAdminException {
+ return sync(() -> getActiveBrokersAsync(null));
+ }
+
+ @Override
+ public CompletableFuture<List<String>> getActiveBrokersAsync() {
+ return getActiveBrokersAsync(null);
+ }
+
@Override
public List<String> getActiveBrokers(String cluster) throws
PulsarAdminException {
return sync(() -> getActiveBrokersAsync(cluster));
}
@Override
public CompletableFuture<List<String>> getActiveBrokersAsync(String
cluster) {
- WebTarget path = adminBrokers.path(cluster);
+ WebTarget path = cluster == null ? adminBrokers :
adminBrokers.path(cluster);
Review comment:
`WebTarget.path` does not support null param, othewise it`ll get "path
is 'null'."
--
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]