DonalEvans commented on a change in pull request #6590:
URL: https://github.com/apache/geode/pull/6590#discussion_r649576384



##########
File path: 
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/collections/SizeableObject2ObjectOpenCustomHashMapWithCursor.java
##########
@@ -29,52 +33,58 @@
  * The scan method provides the same guarantees as Redis's HSCAN, and in fact
  * uses the same algorithm.
  */
-public class Object2ObjectOpenCustomHashMapWithCursor<K, V>
-    extends Object2ObjectOpenCustomHashMap<K, V> {
+public class SizeableObject2ObjectOpenCustomHashMapWithCursor<K, V>
+    extends Object2ObjectOpenCustomHashMap<K, V> implements Sizeable {
+
+  private static final long serialVersionUID = 9079713776660851891L;
+  public static final int BACKING_ARRAY_OVERHEAD_CONSTANT = 136;
+  public static final int BACKING_ARRAY_LENGTH_COEFFICIENT = 4;
+  private static final ReflectionSingleObjectSizer elementSizer =
+      ReflectionSingleObjectSizer.getInstance();
 
+  private int keysOverhead;

Review comment:
       The length of the arrays isn't updated every time an element is added to 
the collection, only when there are sufficient elements to fill a percentage of 
it determined by the load factor, which then forces a resize of the backing 
arrays, so it's necessary to check the length of the arrays to determine the 
current overhead.




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


Reply via email to