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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -100,7 +102,7 @@ protected void grabCnx() {
                             log.error("[{}] [{}] Unexpected exception after 
the connection",
                                     state.topic, state.getHandlerName(), e);
                         }
-                        duringConnect = false;
+                        duringConnect.compareAndSet(true, false);

Review Comment:
   > Suggestion to use compareAndSet everywhere.
   
   It does not resolve anything. CAS on a boolean variable is meaningless. 
`x.compareAndSet(true, false)` is equivalent to `x.set(false)`. What matters is 
the returned value of CAS, which can check if `x` was true before setting it 
with false. @poorbarcode 
   



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