mattisonchao commented on a change in pull request #14853:
URL: https://github.com/apache/pulsar/pull/14853#discussion_r834863059



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
##########
@@ -623,12 +622,14 @@ public void validateBundleOwnership(NamespaceBundle 
bundle, boolean authoritativ
      */
     protected void validateTopicOwnership(TopicName topicName, boolean 
authoritative) {
         try {
-            validateTopicOwnershipAsync(topicName, authoritative).join();
-        } catch (CompletionException ce) {
-            if (ce.getCause() instanceof WebApplicationException) {
-                throw (WebApplicationException) ce.getCause();
+            validateTopicOwnershipAsync(topicName, authoritative)
+                    .get(config().getMetadataStoreOperationTimeoutSeconds(), 
SECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException 
ex) {
+            Throwable realCause = FutureUtil.unwrapCompletionException(ex);
+            if (realCause instanceof WebApplicationException) {
+                throw (WebApplicationException) realCause;
             } else {
-                throw new RestException(ce.getCause());
+                throw new RestException(realCause);
             }

Review comment:
       @lhotari  Yes, you are right, thanks for the suggestion.
   
   I need to say sorry, I didn't look closely at the other duplicate code 
because I found this issue while looking at other features at the time.
   So, I will solve this problem according to your suggestion.




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