hangc0276 commented on code in PR #21231:
URL: https://github.com/apache/pulsar/pull/21231#discussion_r1336556849
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -242,6 +245,34 @@ public TopicPolicies getTopicPolicies(TopicName topicName,
}
}
+ @NotNull
+ @Override
+ public CompletableFuture<Optional<TopicPolicies>>
getTopicPoliciesAsync(@NotNull TopicName topicName,
+
boolean isGlobal) {
+ requireNonNull(topicName);
+ final CompletableFuture<Void> preparedFuture =
prepareInitPoliciesCacheAsync(topicName.getNamespaceObject());
+ return preparedFuture.thenApply(__ -> {
+ final TopicPolicies candidatePolicies = isGlobal
+ ?
globalPoliciesCache.get(TopicName.get(topicName.getPartitionedTopicName()))
+ :
policiesCache.get(TopicName.get(topicName.getPartitionedTopicName()));
+ return Optional.ofNullable(candidatePolicies);
+ });
+ }
+
+ @NotNull
+ @Override
+ public CompletableFuture<Optional<TopicPolicies>>
getTopicPoliciesAsync(@NotNull TopicName topicName) {
+ requireNonNull(topicName);
+ final CompletableFuture<Void> preparedFuture =
prepareInitPoliciesCacheAsync(topicName.getNamespaceObject());
Review Comment:
The same above
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:
##########
@@ -242,6 +245,34 @@ public TopicPolicies getTopicPolicies(TopicName topicName,
}
}
+ @NotNull
+ @Override
+ public CompletableFuture<Optional<TopicPolicies>>
getTopicPoliciesAsync(@NotNull TopicName topicName,
+
boolean isGlobal) {
+ requireNonNull(topicName);
+ final CompletableFuture<Void> preparedFuture =
prepareInitPoliciesCacheAsync(topicName.getNamespaceObject());
Review Comment:
Remove this prepardFuture and merge with the next line?
--
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]