You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/10/04 08:13:36 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #8197: fix pulsar service close exception

eolivelli commented on a change in pull request #8197:
URL: https://github.com/apache/pulsar/pull/8197#discussion_r499218577



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
##########
@@ -215,7 +215,9 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
         super.channelInactive(ctx);
         isActive = false;
         log.info("Closed connection from {}", remoteAddress);
-        getBrokerService().getInterceptor().onConnectionClosed(this);
+        if (getBrokerService().getInterceptor() != null) {
+            getBrokerService().getInterceptor().onConnectionClosed(this);

Review comment:
       In BrokerService we are setting this field to null.
   We could run into some NPE anyway in the future.
   It is better to assign the result of getInterceptor to a local variable and then deference it safely, without calling twice this getter




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org