codelipenghui commented on a change in pull request #11597:
URL: https://github.com/apache/pulsar/pull/11597#discussion_r684872055



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -122,11 +124,17 @@ public ConsumerBuilderImpl(PulsarClientImpl client, 
Schema<T> schema) {
             //Issue 9327: do compatibility check in case of the default retry 
and dead letter topic name changed
             String oldRetryLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
             String oldDeadLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
-            if 
(client.getPartitionedTopicMetadata(oldRetryLetterTopic).join().partitions > 0) 
{
-                retryLetterTopic = oldRetryLetterTopic;
-            }
-            if 
(client.getPartitionedTopicMetadata(oldDeadLetterTopic).join().partitions > 0) {
-                deadLetterTopic = oldDeadLetterTopic;
+            try {
+                if (client.getPartitionedTopicMetadata(oldRetryLetterTopic)
+                        .get(client.conf.getOperationTimeoutMs(), 
TimeUnit.MILLISECONDS).partitions > 0) {
+                    retryLetterTopic = oldRetryLetterTopic;
+                }
+                if (client.getPartitionedTopicMetadata(oldDeadLetterTopic)
+                        .get(client.conf.getOperationTimeoutMs(), 
TimeUnit.MILLISECONDS).partitions > 0) {
+                    deadLetterTopic = oldDeadLetterTopic;
+                }
+            } catch (InterruptedException | TimeoutException | 
ExecutionException e) {
+                return FutureUtil.failedFuture(e);

Review comment:
       Should return FutureUtil.failedFuture(e.getCause()) if e is 
ExecutionException?

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/NonPersistentTopics.java
##########
@@ -297,7 +298,14 @@ public void getList(@Suspended final AsyncResponse 
asyncResponse, @PathParam("pr
     }
 
     private Topic getTopicReference(TopicName topicName) {
-        return 
pulsar().getBrokerService().getTopicIfExists(topicName.toString()).join()
-                .orElseThrow(() -> new RestException(Status.NOT_FOUND, "Topic 
not found"));
+        try {
+            return 
pulsar().getBrokerService().getTopicIfExists(topicName.toString())
+                    .get(config().getZooKeeperOperationTimeoutSeconds(), 
TimeUnit.SECONDS)
+                    .orElseThrow(() -> new RestException(Status.NOT_FOUND, 
"Topic not found"));
+        } catch (ExecutionException e) {
+            throw new RuntimeException(e.getCause());

Review comment:
       Should throw RestException here?




-- 
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]


Reply via email to