Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
HQebupt committed Jun 27, 2022
1 parent f99a682 commit c8ecf13
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,22 +319,6 @@ protected void internalGrantPermissionsOnTopic(final AsyncResponse asyncResponse
});
}

protected void internalDeleteTopicForcefully(boolean authoritative) {
validateTopicOwnership(topicName, authoritative);
validateNamespaceOperation(topicName.getNamespaceObject(), NamespaceOperation.DELETE_TOPIC);

try {
pulsar().getBrokerService().deleteTopic(topicName.toString(), true).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);
}
}
}

private CompletableFuture<Void> revokePermissionsAsync(String topicUri, String role) {
return namespaceResources().getPoliciesAsync(namespaceName).thenCompose(
policiesOptional -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.pulsar.broker.admin.impl.PersistentTopicsBase;
import org.apache.pulsar.broker.service.BrokerServiceException;
import org.apache.pulsar.broker.web.RestException;
import org.apache.pulsar.client.admin.LongRunningProcessStatus;
import org.apache.pulsar.client.api.MessageId;
Expand Down Expand Up @@ -369,10 +368,7 @@ public void deleteTopic(
.thenAccept(__ -> asyncResponse.resume(Response.noContent().build()))
.exceptionally(ex -> {
Throwable t = FutureUtil.unwrapCompletionException(ex);
if (t instanceof BrokerServiceException.TopicBusyException) {
ex = new RestException(Response.Status.PRECONDITION_FAILED,
"Topic has active producers/subscriptions");
} else if (isManagedLedgerNotFoundException(t)) {
if (isManagedLedgerNotFoundException(t)) {
ex = new RestException(Response.Status.NOT_FOUND,
getTopicNotFoundErrorMessage(topicName.toString()));
} else if (!isRedirectException(ex)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.pulsar.broker.admin.impl.PersistentTopicsBase;
import org.apache.pulsar.broker.service.BrokerServiceException;
import org.apache.pulsar.broker.web.RestException;
import org.apache.pulsar.client.admin.LongRunningProcessStatus;
import org.apache.pulsar.client.api.MessageId;
Expand Down Expand Up @@ -1051,10 +1050,7 @@ public void deleteTopic(
.thenAccept(__ -> asyncResponse.resume(Response.noContent().build()))
.exceptionally(ex -> {
Throwable t = FutureUtil.unwrapCompletionException(ex);
if (t instanceof BrokerServiceException.TopicBusyException) {
ex = new RestException(Response.Status.PRECONDITION_FAILED,
"Topic has active producers/subscriptions");
} else if (isManagedLedgerNotFoundException(t)) {
if (isManagedLedgerNotFoundException(t)) {
ex = new RestException(Response.Status.NOT_FOUND,
getTopicNotFoundErrorMessage(topicName.toString()));
} else if (!isRedirectException(ex)) {
Expand Down

0 comments on commit c8ecf13

Please sign in to comment.