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


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:
##########
@@ -1296,6 +1296,9 @@ private void checkRequestTimeout() {
                 break;
             }
             request = requestTimeoutQueue.poll();

Review Comment:
   I think we should check the `request` returned by `poll()` is exactly the 
same with what `peek()` returns. Otherwise, the `request.isTimedOut` call 
doesn't apply on the removed request.
   
   I think it's better to use `remove` here instead of the null check.
   
   ```java
               if (!requestTimeoutQueue.remove(request)) {
                   // the request has been removed by another thread
                   continue;
               }
   ```



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