lovelle commented on a change in pull request #5793: Fixes some minor thread 
safety violations
URL: https://github.com/apache/pulsar/pull/5793#discussion_r356252113
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
 ##########
 @@ -517,13 +516,16 @@ private OpBatchReceive(CompletableFuture<Messages<T>> 
future) {
     }
 
     protected void notifyPendingBatchReceivedCallBack() {
-        final OpBatchReceive<T> opBatchReceive = pendingBatchReceives.poll();
+        final OpBatchReceive<T> opBatchReceive = getOpBatchReceive();
         if (opBatchReceive == null || opBatchReceive.future == null) {
             return;
         }
         notifyPendingBatchReceivedCallBack(opBatchReceive);
     }
 
+    private synchronized OpBatchReceive<T> getOpBatchReceive() {
 
 Review comment:
   Very true! static analyzer I used neither me realized that! Just rollbacked 
this :+1: 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to