This is an automated email from the ASF dual-hosted git repository. lhotari pushed a commit to branch branch-4.0 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 83274ac7428c7a28cb2b3f9fd9b5aee6e3eba06a Author: fengyubiao <[email protected]> AuthorDate: Wed Dec 10 16:14:11 2025 +0800 [fix][cli] Fix some pulsar-admin topicPolicies commands exiting before async operations complete (#25051) Co-authored-by: Jiwe Guo <[email protected]> (cherry picked from commit b3c51485d1a15562d700a3a592e072dbea457ec1) --- .../main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java index 28164ca4c30..86a48cb20a7 100644 --- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java +++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java @@ -1959,7 +1959,7 @@ public class CmdTopicPolicies extends CmdBase { @Override void run() throws PulsarAdminException { String persistentTopic = validatePersistentTopic(topicName); - getTopicPolicies(isGlobal).setDispatcherPauseOnAckStatePersistent(persistentTopic); + sync(() -> getTopicPolicies(isGlobal).setDispatcherPauseOnAckStatePersistent(persistentTopic)); } } @@ -1978,7 +1978,8 @@ public class CmdTopicPolicies extends CmdBase { @Override void run() throws PulsarAdminException { String persistentTopic = validatePersistentTopic(topicName); - print(getTopicPolicies(isGlobal).getDispatcherPauseOnAckStatePersistent(persistentTopic, applied)); + print(sync(() -> + (getTopicPolicies(isGlobal).getDispatcherPauseOnAckStatePersistent(persistentTopic, applied)))); } } @@ -1994,7 +1995,7 @@ public class CmdTopicPolicies extends CmdBase { @Override void run() throws PulsarAdminException { String persistentTopic = validatePersistentTopic(topicName); - getTopicPolicies(isGlobal).removeDispatcherPauseOnAckStatePersistent(persistentTopic); + sync(() -> getTopicPolicies(isGlobal).removeDispatcherPauseOnAckStatePersistent(persistentTopic)); } } @@ -2016,7 +2017,7 @@ public class CmdTopicPolicies extends CmdBase { void run() throws PulsarAdminException { String persistentTopic = validatePersistentTopic(topicName); List<String> clusters = Lists.newArrayList(clusterIds.split(",")); - getTopicPolicies(isGlobal).setReplicationClusters(persistentTopic, clusters); + sync(() -> getTopicPolicies(isGlobal).setReplicationClusters(persistentTopic, clusters)); } }
