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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -63,11 +66,20 @@ protected void grabCnx() {
             return;
         }
 
-        if (!isValidStateForReconnection()) {
-            // Ignore connection closed when we are shutting down
-            log.info("[{}] [{}] Ignoring reconnection request (state: {})",
-                    state.topic, state.getHandlerName(), state.getState());
-            return;
+        synchronized (this) {
+            if (duringConnect) {
+                log.info("[{}] [{}] Skip grabbing the connection since there 
is a pending connection",
+                        state.topic, state.getHandlerName());
+                return;
+            }
+            if (isValidStateForReconnection()) {

Review Comment:
   The purpose of this PR is to avoid more than one `grabCnx` running at the 
same time, right? And does not address the execution of `grabCnx` even if the 
state is `Ready`, right?
   



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