poorbarcode commented on code in PR #20595:
URL: https://github.com/apache/pulsar/pull/20595#discussion_r1245387433
##########
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:
I do not think so, this will makes more than one `granCnx` running at the
same time. For example:
| time | `task 1` | `task 2` | `task 3` |
| --- | --- | --- | --- |
| 1 | grab connection |
| 2 | `duringConnect` --> `true` |
| 3 | recconect |
| 4 | `duringConnect` --> `false` |
| 5 | | grab connection |
| 6 | | `duringConnect` --> `true` |
| 7 | after the future complete |
| 8 | `duringConnect` --> `false` |
| 9 | | | grab connection |
| 10 | | | `duringConnect` --> `true` |
Suggestion to use `compareAndSet` everywhere.
--
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]