codelipenghui commented on a change in pull request #13888:
URL: https://github.com/apache/pulsar/pull/13888#discussion_r794530792
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -4704,104 +4704,110 @@ protected void
internalGetReplicatedSubscriptionStatus(AsyncResponse asyncRespon
}
// Permission to consume this topic is required
- try {
- validateTopicOperation(topicName,
TopicOperation.GET_REPLICATED_SUBSCRIPTION_STATUS, subName);
- } catch (Exception e) {
- resumeAsyncResponseExceptionally(asyncResponse, e);
- return;
- }
+ CompletableFuture<Void> validateFuture =
+ validateTopicOperationAsync(topicName,
TopicOperation.GET_REPLICATED_SUBSCRIPTION_STATUS, subName);
+ CompletableFuture<Void> resultFuture;
// If the topic name is a partition name, no need to get partition
topic metadata again
if (topicName.isPartitioned()) {
-
internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(asyncResponse,
subName, authoritative);
+ resultFuture = validateFuture.thenAccept(
+ __ ->
internalGetReplicatedSubscriptionStatusForNonPartitionedTopic(asyncResponse,
+ subName, authoritative));
} else {
- getPartitionedTopicMetadataAsync(topicName,
- authoritative, false).thenAccept(partitionMetadata -> {
- if (partitionMetadata.partitions > 0) {
- final List<CompletableFuture<Map<String, Boolean>>>
futures = Lists.newArrayList();
- final Map<String, Boolean> status = Maps.newHashMap();
+ resultFuture = validateFuture
+ .thenCompose(__ ->
getPartitionedTopicMetadataAsync(topicName, authoritative, false))
+ .thenAccept(partitionMetadata -> {
+ if (partitionMetadata.partitions > 0) {
+ final List<CompletableFuture<Map<String,
Boolean>>> futures = Lists.newArrayList();
Review comment:
@suiyuzeng Could you please check the comment?
--
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]