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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -81,8 +93,15 @@ protected void grabCnx() {
             } else {
                 cnxFuture = state.client.getConnection(state.topic); //
             }
-            cnxFuture.thenAccept(cnx -> connection.connectionOpened(cnx)) //
-                    .exceptionally(this::handleConnectionError);
+            cnxFuture.thenCompose(cnx -> connection.connectionOpened(cnx))
+                    .exceptionally(this::handleConnectionError)
+                    .whenComplete((__, e) -> {
+                        if (e != null) {
+                            log.error("[{}] [{}] Unexpected exception after 
the connection",
+                                    state.topic, state.getHandlerName(), e);
+                        }
+                        duringConnect = false;

Review Comment:
   I think not, `grabCnx` will be executed after some time, while 
`duringConnect = false` will be executed immediately after 
`handleConnectionError` is called.
   
   ```java
               state.client.timer().newTimeout(timeout -> {
                   log.info("[{}] [{}] Reconnecting after connection was 
closed", state.topic, state.getHandlerName());
                   grabCnx();
               }, delayMs, TimeUnit.MILLISECONDS);
   ```



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