You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sa...@apache.org on 2016/03/01 19:15:48 UTC

incubator-geode git commit: fixed few more review comments

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-996 68014481f -> a50e1209e


fixed few more review comments


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a50e1209
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a50e1209
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a50e1209

Branch: refs/heads/feature/GEODE-996
Commit: a50e1209e60ad8934fe8c97a213ced6dc795328d
Parents: 6801448
Author: Sai Boorlagadda <sb...@pivotal.io>
Authored: Tue Mar 1 10:15:34 2016 -0800
Committer: Sai Boorlagadda <sb...@pivotal.io>
Committed: Tue Mar 1 10:15:34 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/offheap/FreeListManager.java     |  7 +++----
 .../gemfire/internal/offheap/FreeListManagerTest.java | 14 +++++++-------
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a50e1209/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
index 3f7035c..b9e31e0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
@@ -473,7 +473,7 @@ public class FreeListManager {
     }
   }
   
-  protected int getFragmentsCount() {
+  protected int getFragmentCount() {
     return this.fragmentList.size();
   }
   
@@ -482,7 +482,7 @@ public class FreeListManager {
       //when no memory is used then there is no fragmentation
       return 0;
     } else {
-      int availableFragments = getFragmentsCount();
+      int availableFragments = getFragmentCount();
       if (availableFragments == 0) {
         //zero fragments means no free memory then no fragmentation
         return 0;
@@ -491,9 +491,8 @@ public class FreeListManager {
         return 0;
       } else {
         //more than 1 fragment is available so freeMemory is > 0
-        //compare the no. of available fragments with max no. of possible fragments
         long freeMemory = getFreeMemory();
-        assert freeMemory > 0;
+        assert freeMemory > ObjectChunk.MIN_CHUNK_SIZE;
         long maxPossibleFragments = freeMemory / ObjectChunk.MIN_CHUNK_SIZE;
         double fragmentation = ((double) availableFragments /(double) maxPossibleFragments) * 100d;
         return (int) Math.rint(fragmentation);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a50e1209/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
index 764944b..9bfb2eb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
@@ -747,7 +747,7 @@ public class FreeListManagerTest {
     
     FreeListManager spy = spy(this.freeListManager);
     
-    when(spy.getFragmentsCount()).thenReturn(0);
+    when(spy.getFragmentCount()).thenReturn(0);
     
     assertThat(spy.getFragmentation()).isZero();
   }
@@ -759,7 +759,7 @@ public class FreeListManagerTest {
     
     FreeListManager spy = spy(this.freeListManager);
     
-    when(spy.getFragmentsCount()).thenReturn(1);
+    when(spy.getFragmentCount()).thenReturn(1);
     
     assertThat(spy.getFragmentation()).isZero();
   }
@@ -784,7 +784,7 @@ public class FreeListManagerTest {
     FreeListManager spy = spy(this.freeListManager);
     
     when(spy.getUsedMemory()).thenReturn(1L);
-    when(spy.getFragmentsCount()).thenReturn(2);
+    when(spy.getFragmentCount()).thenReturn(2);
     when(spy.getFreeMemory()).thenReturn((long)ObjectChunk.MIN_CHUNK_SIZE * 2);
     
     assertThat(spy.getFragmentation()).isEqualTo(100);
@@ -798,25 +798,25 @@ public class FreeListManagerTest {
     FreeListManager spy = spy(this.freeListManager);
     
     when(spy.getUsedMemory()).thenReturn(1L);
-    when(spy.getFragmentsCount()).thenReturn(4);
+    when(spy.getFragmentCount()).thenReturn(4);
     when(spy.getFreeMemory()).thenReturn((long)ObjectChunk.MIN_CHUNK_SIZE * 8);
     
     assertThat(spy.getFragmentation()).isEqualTo(50); //Math.rint(50.0)
     
     when(spy.getUsedMemory()).thenReturn(1L);
-    when(spy.getFragmentsCount()).thenReturn(3);
+    when(spy.getFragmentCount()).thenReturn(3);
     when(spy.getFreeMemory()).thenReturn((long)ObjectChunk.MIN_CHUNK_SIZE * 8);
     
     assertThat(spy.getFragmentation()).isEqualTo(38); //Math.rint(37.5)
     
     when(spy.getUsedMemory()).thenReturn(1L);
-    when(spy.getFragmentsCount()).thenReturn(6);
+    when(spy.getFragmentCount()).thenReturn(6);
     when(spy.getFreeMemory()).thenReturn((long)ObjectChunk.MIN_CHUNK_SIZE * 17);
     
     assertThat(spy.getFragmentation()).isEqualTo(35); //Math.rint(35.29)
     
     when(spy.getUsedMemory()).thenReturn(1L);
-    when(spy.getFragmentsCount()).thenReturn(6);
+    when(spy.getFragmentCount()).thenReturn(6);
     when(spy.getFreeMemory()).thenReturn((long)ObjectChunk.MIN_CHUNK_SIZE * 9);
     
     assertThat(spy.getFragmentation()).isEqualTo(67); //Math.rint(66.66)