diff --git a/pulsar-broker/src/main/java/com/yahoo/pulsar/broker/service/Producer.java b/pulsar-broker/src/main/java/com/yahoo/pulsar/broker/service/Producer.java index 65136763380c4..ffa1607275b49 100644 --- a/pulsar-broker/src/main/java/com/yahoo/pulsar/broker/service/Producer.java +++ b/pulsar-broker/src/main/java/com/yahoo/pulsar/broker/service/Producer.java @@ -328,8 +328,10 @@ void closeNow() { public CompletableFuture disconnect() { if (!closeFuture.isDone()) { log.info("Disconnecting producer: {}", this); - cnx.closeProducer(this); - closeNow(); + cnx.ctx().executor().execute(() -> { + cnx.closeProducer(this); + closeNow(); + }); } return closeFuture; }