lhotari commented on a change in pull request #14853:
URL: https://github.com/apache/pulsar/pull/14853#discussion_r834545025
##########
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:
You could also consider an approach to replace all `.join()` calls at
once in the PulsarWebResource subclasses instead of sending PRs one by one.
--
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]