You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/12/10 20:07:57 UTC

[GitHub] [pulsar] lovelle commented on a change in pull request #5793: Fixes some minor thread safety violations

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:
users@infra.apache.org


With regards,
Apache Git Services