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 2021/04/27 17:05:46 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #10400: [Broker] Fix issue in reusing EntryBatchIndexesAcks instances

merlimat commented on a change in pull request #10400:
URL: https://github.com/apache/pulsar/pull/10400#discussion_r621420500



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/EntryBatchIndexesAcks.java
##########
@@ -50,12 +51,20 @@ public void recycle() {
         handle.recycle(this);
     }
 
+    private void ensureCapacityAndReset(int entriesListSize) {
+        size = entriesListSize;
+        if (indexesAcks.length < size) {
+            indexesAcks = new Pair[size];
+        } else {
+            for (int i = 0; i < size; i++) {
+                indexesAcks[i] = null;

Review comment:
       Instead of setting to null here, it would be better to do it in the recycle so the instances of `Pair` are staying valid for a smaller amount of time.




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