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 2022/06/06 02:52:06 UTC

[GitHub] [pulsar] Jason918 commented on a diff in pull request #15936: Support shrink for TripleLongPriorityQueue

Jason918 commented on code in PR #15936:
URL: https://github.com/apache/pulsar/pull/15936#discussion_r889788102


##########
pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/TripleLongPriorityQueue.java:
##########
@@ -49,14 +62,21 @@ public TripleLongPriorityQueue() {
         this(DEFAULT_INITIAL_CAPACITY);
     }
 
+    public TripleLongPriorityQueue(int initialCapacity, float shrinkFactor) {
+        checkArgument(shrinkFactor > 0);
+        this.initialCapacity = initialCapacity;
+        this.capacity = initialCapacity;
+        this.buffer = PooledByteBufAllocator.DEFAULT.directBuffer(initialCapacity * ITEMS_COUNT * SIZE_OF_LONG);

Review Comment:
   `TUPLE_SIZE` can be used instead of `ITEMS_COUNT * SIZE_OF_LONG`



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org