nodece commented on a change in pull request #14069:
URL: https://github.com/apache/pulsar/pull/14069#discussion_r801246623



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -311,20 +311,26 @@ protected void internalGrantPermissionsOnTopic(String 
role, Set<AuthAction> acti
         grantPermissions(topicName, role, actions);
     }
 
-    protected void internalDeleteTopicForcefully(boolean authoritative, 
boolean deleteSchema) {
-        validateTopicOwnership(topicName, authoritative);
-        validateNamespaceOperation(topicName.getNamespaceObject(), 
NamespaceOperation.DELETE_TOPIC);
-
-        try {
-            pulsar().getBrokerService().deleteTopic(topicName.toString(), 
true, deleteSchema).get();
-        } catch (Exception e) {
-            if (isManagedLedgerNotFoundException(e)) {
-                log.info("[{}] Topic was already not existing {}", 
clientAppId(), topicName, e);
-            } else {
-                log.error("[{}] Failed to delete topic forcefully {}", 
clientAppId(), topicName, e);
-                throw new RestException(e);
-            }
-        }
+    protected void internalDeleteTopicForcefully(AsyncResponse asyncResponse, 
boolean authoritative,
+                                                 boolean deleteSchema) {
+        validateTopicOwnershipAsync(topicName, authoritative)
+                .thenCompose(__ -> 
validateNamespaceOperationAsync(topicName.getNamespaceObject(),
+                        NamespaceOperation.DELETE_TOPIC))
+                .thenCompose(__ -> 
pulsar().getBrokerService().deleteTopic(topicName.toString(), true, 
deleteSchema))
+                .thenRun(() -> {
+                    log.info("[{}] Successfully removed topic {}", 
clientAppId(), topicName);
+                    asyncResponse.resume(Response.noContent().build());
+                })
+                .exceptionally(e -> {
+                    if (isManagedLedgerNotFoundException(e.getCause())) {

Review comment:
       ```suggestion
                       if (isManagedLedgerNotFoundException(throwable)) {
   ```




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