Skip to content

Commit

Permalink
[fix][broker] call ServerCnx#closeProducer from correct thread (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljmarshall authored Jul 7, 2023
1 parent c1f52f8 commit 0bac873
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ private void buildProducerAndAddTopic(Topic topic, long producerId, String produ
}

producers.remove(producerId, producerFuture);
}).exceptionally(ex -> {
}).exceptionallyAsync(ex -> {
if (ex.getCause() instanceof BrokerServiceException.TopicMigratedException) {
Optional<ClusterUrl> clusterURL = getMigratedClusterUrl(service.getPulsar());
if (clusterURL.isPresent()) {
Expand Down Expand Up @@ -1654,7 +1654,7 @@ private void buildProducerAndAddTopic(Topic topic, long producerId, String produ
BrokerServiceException.getClientErrorCode(ex), ex.getMessage());
}
return null;
});
}, ctx.executor());

producerQueuedFuture.thenRun(() -> {
// If the producer is queued waiting, we will get an immediate notification
Expand Down Expand Up @@ -2933,6 +2933,7 @@ protected void interceptCommand(BaseCommand command) throws InterceptException {

@Override
public void closeProducer(Producer producer) {
assert ctx.executor().inEventLoop();
// removes producer-connection from map and send close command to producer
safelyRemoveProducer(producer);
if (getRemoteEndpointProtocolVersion() >= v5.getValue()) {
Expand Down

0 comments on commit 0bac873

Please sign in to comment.