You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/01/19 03:47:18 UTC
[GitHub] [pulsar] Jason918 commented on a change in pull request #13805: [Broker] Fix call sync method in async rest api for ``internalDeletePartitionedTopic``
Jason918 commented on a change in pull request #13805:
URL: https://github.com/apache/pulsar/pull/13805#discussion_r787328458
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -560,23 +560,12 @@ protected PartitionedTopicMetadata internalGetPartitionedMetadata(boolean author
protected void internalDeletePartitionedTopic(AsyncResponse asyncResponse, boolean authoritative,
boolean force, boolean deleteSchema) {
- try {
- validateNamespaceOperation(topicName.getNamespaceObject(), NamespaceOperation.DELETE_TOPIC);
- validateTopicOwnership(topicName, authoritative);
- } catch (WebApplicationException wae) {
- if (log.isDebugEnabled()) {
- log.debug("[{}] Failed to delete partitioned topic {}, redirecting to other brokers.",
- clientAppId(), topicName, wae);
- }
- resumeAsyncResponseExceptionally(asyncResponse, wae);
- return;
- } catch (Exception e) {
- log.error("[{}] Failed to delete partitioned topic {}", clientAppId(), topicName, e);
- resumeAsyncResponseExceptionally(asyncResponse, e);
- return;
- }
+ CompletableFuture<PartitionedTopicMetadata> partitionedTopicMetadataCompletableFuture =
+ validateNamespaceOperationAsync(topicName.getNamespaceObject(), NamespaceOperation.DELETE_TOPIC)
+ .thenApply(__ -> validateTopicOwnershipAsync(topicName, authoritative))
+ .thenCompose(__ -> pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(topicName));
Review comment:
Do we need this `partitionedTopicMetadataCompletableFuture`? It seems we can just add the next `thenAccept` 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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org