poorbarcode commented on code in PR #23123:
URL: https://github.com/apache/pulsar/pull/23123#discussion_r1703485240


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -3605,19 +3605,38 @@ public String clientSourceAddressAndPort() {
 
     @Override
     public CompletableFuture<Optional<Boolean>> checkConnectionLiveness() {
+        if (!isActive()) {
+            return CompletableFuture.completedFuture(Optional.of(false));
+        }
         if (connectionLivenessCheckTimeoutMillis > 0) {
             return 
NettyFutureUtil.toCompletableFuture(ctx.executor().submit(() -> {
+                if (!isActive()) {
+                    return 
CompletableFuture.completedFuture(Optional.of(false));
+                }
                 if (connectionCheckInProgress != null) {
                     return connectionCheckInProgress;
                 } else {
                     final CompletableFuture<Optional<Boolean>> 
finalConnectionCheckInProgress =
                             new CompletableFuture<>();
                     connectionCheckInProgress = finalConnectionCheckInProgress;
                     ctx.executor().schedule(() -> {
+                        if (!isActive()) {
+                            
finalConnectionCheckInProgress.complete(Optional.of(false));
+                            return;
+                        }
                         if (finalConnectionCheckInProgress == 
connectionCheckInProgress
                                 && !finalConnectionCheckInProgress.isDone()) {
                             log.warn("[{}] Connection check timed out. Closing 
connection.", this.toString());
                             ctx.close();
+                        } else if (finalConnectionCheckInProgress != 
connectionCheckInProgress){
+                            log.info("[{}] Connection check might be success, 
because the variable"

Review Comment:
   More explanation here: 
https://github.com/apache/pulsar/pull/23123#discussion_r1703485137



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

Reply via email to