mattisonchao commented on code in PR #21333:
URL: https://github.com/apache/pulsar/pull/21333#discussion_r1353834334
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2136,13 +2136,16 @@ public void monitorBacklogQuota() {
});
}
- public boolean isTopicNsOwnedByBroker(TopicName topicName) {
- try {
- return pulsar.getNamespaceService().isServiceUnitOwned(topicName);
- } catch (Exception e) {
- log.warn("Failed to check the ownership of the topic: {}, {}",
topicName, e.getMessage());
- }
- return false;
+ public CompletableFuture<Boolean> isTopicNsOwnedByBrokerAsync(TopicName
topicName) {
+ return pulsar.getNamespaceService().isServiceUnitOwnedAsync(topicName)
+ .handle((hasOwnership, t) -> {
+ if (t == null) {
+ return hasOwnership;
+ } else {
+ log.warn("Failed to check the ownership of the topic:
{}, {}", topicName, t.getMessage());
+ return false;
Review Comment:
Just want to confirm if the logic will fall into an infinity lookup loop in
the worst condition. :)
--
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]