lhotari commented on a change in pull request #13428:
URL: https://github.com/apache/pulsar/pull/13428#discussion_r773334755
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -292,24 +292,30 @@ public void channelInactive(ChannelHandlerContext ctx)
throws Exception {
// Connection is gone, close the producers immediately
producers.forEach((__, producerFuture) -> {
+ // prevent race conditions in completing producers
+ if (!producerFuture.isDone()
+ && producerFuture.completeExceptionally(new
IllegalStateException("Connection closed."))) {
Review comment:
no, it's different. Creating an exception is a heavy operation and the
original version prevents that from happening if it's done.
--
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]