geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [21/38] incubator-geode git commit: renamed ObjectChunk to ObjectStoredInMemory
Date Sat, 05 Mar 2016 00:51:21 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b75d0400/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
index f101688..71bac49 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
@@ -107,7 +107,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
 
       SyncChunkStack stack = new SyncChunkStack(chunk.getMemoryAddress());
       assertEquals(false, stack.isEmpty());
@@ -121,7 +121,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
 
       SyncChunkStack stack = new SyncChunkStack();
       stack.offer(chunk.getMemoryAddress());
@@ -136,7 +136,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
 
       long addr = chunk.getMemoryAddress();
       SyncChunkStack stack = new SyncChunkStack();
@@ -163,7 +163,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
 
       long addr = chunk.getMemoryAddress();
       SyncChunkStack stack = new SyncChunkStack();
@@ -181,7 +181,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
 
       long addr = chunk.getMemoryAddress();
       SyncChunkStack stack = new SyncChunkStack();
@@ -199,7 +199,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
       int chunkSize = chunk.getSize();
 
       long addr = chunk.getMemoryAddress();
@@ -217,7 +217,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
       int chunkSize = chunk.getSize();
 
       long addr = chunk.getMemoryAddress();
@@ -242,7 +242,7 @@ public class SyncChunkStackJUnitTest {
     protected void testHookDoConcurrentModification() {
       if (doConcurrentMod) {
         doConcurrentMod = false;
-        ObjectChunk chunk2 = (ObjectChunk) ma.allocate(50);
+        ObjectStoredInMemory chunk2 = (ObjectStoredInMemory) ma.allocate(50);
         this.chunk2Size = chunk2.getSize();
         this.offer(chunk2.getMemoryAddress());
       }
@@ -253,7 +253,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
       int chunkSize = chunk.getSize();
 
       long addr = chunk.getMemoryAddress();
@@ -272,7 +272,7 @@ public class SyncChunkStackJUnitTest {
     SlabImpl slab = new SlabImpl(1024);
     try {
       SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(),
new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      ObjectChunk chunk = (ObjectChunk) ma.allocate(100);
+      ObjectStoredInMemory chunk = (ObjectStoredInMemory) ma.allocate(100);
       int chunkSize = chunk.getSize();
 
       long addr = chunk.getMemoryAddress();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b75d0400/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
index 3a086ae..7c87079 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/TinyMemoryBlockJUnitTest.java
@@ -137,7 +137,7 @@ public class TinyMemoryBlockJUnitTest {
 
   @Test
   public void getBlockSizeReturnsReturnsSizeOfUnderlyingChunk() {
-    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
+    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
     softly.assertThat(mb.getBlockSize()).isEqualTo(slabs[0].getSize());
   }
 
@@ -145,7 +145,7 @@ public class TinyMemoryBlockJUnitTest {
   public void getNextBlockThrowsUnsupportedOperationException() {
     expectedException.expect(UnsupportedOperationException.class);
 
-    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
+    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
     mb.getNextBlock();
     fail("getNextBlock failed to throw UnsupportedOperationException");
   }
@@ -154,23 +154,23 @@ public class TinyMemoryBlockJUnitTest {
   public void getSlabIdThrowsUnsupportedOperationException() {
     expectedException.expect(UnsupportedOperationException.class);
 
-    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
+    MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
     mb.getSlabId();
     fail("getSlabId failed to throw UnsupportedOperationException");
   }
 
   @Test
   public void getFreeListIdReturnsIdBlockWasConstructedWith() {
-    MemoryBlock mb0 = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
-    MemoryBlock mb1 = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[1].getMemoryAddress(),
slabs[1].getSize()).getMemoryAddress(), 1);
+    MemoryBlock mb0 = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
+    MemoryBlock mb1 = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[1].getMemoryAddress(),
slabs[1].getSize()).getMemoryAddress(), 1);
     softly.assertThat(mb0.getFreeListId()).isEqualTo(0);
     softly.assertThat(mb1.getFreeListId()).isEqualTo(1);
   }
 
   @Test
   public void getRefCountReturnsZero() {
-    MemoryBlock mb0 = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
-    MemoryBlock mb1 = new TestableFreeListManager.TinyMemoryBlock(new ObjectChunk(slabs[1].getMemoryAddress(),
slabs[1].getSize()).getMemoryAddress(), 1);
+    MemoryBlock mb0 = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).getMemoryAddress(), 0);
+    MemoryBlock mb1 = new TestableFreeListManager.TinyMemoryBlock(new ObjectStoredInMemory(slabs[1].getMemoryAddress(),
slabs[1].getSize()).getMemoryAddress(), 1);
     softly.assertThat(mb0.getRefCount()).isEqualTo(0);
     softly.assertThat(mb1.getRefCount()).isEqualTo(0);
   }
@@ -238,7 +238,7 @@ public class TinyMemoryBlockJUnitTest {
   @Test
   public void hashCodeReturnsHashOfUnderlyingMemory() {
     MemoryBlock mb = new TestableFreeListManager.TinyMemoryBlock(slabs[0].getMemoryAddress(),
0);
-    softly.assertThat(mb.hashCode()).isEqualTo(new ObjectChunk(slabs[0].getMemoryAddress(),
slabs[0].getSize()).hashCode());
+    softly.assertThat(mb.hashCode()).isEqualTo(new ObjectStoredInMemory(slabs[0].getMemoryAddress(),
slabs[0].getSize()).hashCode());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b75d0400/geode-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
index 3d06e11..ab1fce7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/OffHeapManagementDUnitTest.java
@@ -36,7 +36,7 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.offheap.ObjectChunk;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredInMemory;
 import com.gemstone.gemfire.internal.offheap.OffHeapMemoryStats;
 import com.gemstone.gemfire.internal.offheap.OffHeapStorage;
 import com.gemstone.gemfire.management.internal.MBeanJMXAdapter;
@@ -240,7 +240,7 @@ public class OffHeapManagementDUnitTest extends CacheTestCase {
       
       // After allocating large chunk (equal to total memory) 
       // we should still have no fragmentation
-      int largeChunk = (int) TOTAL_MEMORY - ObjectChunk.OFF_HEAP_HEADER_SIZE;
+      int largeChunk = (int) TOTAL_MEMORY - ObjectStoredInMemory.OFF_HEAP_HEADER_SIZE;
       doPutOnVm(vm, KEY, new byte[largeChunk], OFF_HEAP_REGION_NAME, false);
       // No compaction has run, so fragmentation should be zero
       assertFragmentationStatOnVm(vm,0,ASSERT_OP.EQUAL);
@@ -255,7 +255,7 @@ public class OffHeapManagementDUnitTest extends CacheTestCase {
       assertFragmentationStatOnVm(vm,0,ASSERT_OP.EQUAL);
       
       // Allocate HALF_TOTAL_MEMORY twice and release one to create one fragment
-      int halfChunk = HALF_TOTAL_MEMORY - ObjectChunk.OFF_HEAP_HEADER_SIZE;
+      int halfChunk = HALF_TOTAL_MEMORY - ObjectStoredInMemory.OFF_HEAP_HEADER_SIZE;
       doPutOnVm(vm, KEY + "0", new byte[halfChunk], OFF_HEAP_REGION_NAME, false);
       doPutOnVm(vm, KEY + "1", new byte[halfChunk], OFF_HEAP_REGION_NAME, false);
       doDestroyOnVm(vm, KEY + "0", OFF_HEAP_REGION_NAME);
@@ -267,7 +267,7 @@ public class OffHeapManagementDUnitTest extends CacheTestCase {
       
       // Consume the available fragment as below
       // [16][262120][16][262120][16] = [524288] (HALF_TOTAL_MEMORY)
-      int smallChunk = ObjectChunk.MIN_CHUNK_SIZE - ObjectChunk.OFF_HEAP_HEADER_SIZE;
+      int smallChunk = ObjectStoredInMemory.MIN_CHUNK_SIZE - ObjectStoredInMemory.OFF_HEAP_HEADER_SIZE;
       int mediumChunk = 262112; //(262120 - ObjectChunk.OFF_HEAP_HEADER_SIZE)
       doPutOnVm(vm, KEY + "S1", new byte[smallChunk], OFF_HEAP_REGION_NAME, false);
       doPutOnVm(vm, KEY + "M1", new byte[mediumChunk], OFF_HEAP_REGION_NAME, false);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b75d0400/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteBufferByteSourceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteBufferByteSourceJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteBufferByteSourceJUnitTest.java
index 0f918cb..0e80f85 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteBufferByteSourceJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteBufferByteSourceJUnitTest.java
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
 
 import org.junit.experimental.categories.Category;
 
-import com.gemstone.gemfire.internal.offheap.ObjectChunk;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredInMemory;
 import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
 import com.gemstone.gemfire.internal.offheap.StoredObject;
 import com.gemstone.gemfire.internal.tcp.ByteBufferInputStream.ByteSource;
@@ -35,8 +35,8 @@ public class OffHeapByteBufferByteSourceJUnitTest extends OffHeapByteSourceJUnit
   @Override
   protected ByteSource createByteSource(byte[] bytes) {
     StoredObject so = SimpleMemoryAllocatorImpl.getAllocator().allocateAndInitialize(bytes,
false, false);
-    if (so instanceof ObjectChunk) {
-      ObjectChunk c = (ObjectChunk) so;
+    if (so instanceof ObjectStoredInMemory) {
+      ObjectStoredInMemory c = (ObjectStoredInMemory) so;
       ByteBuffer bb = c.createDirectByteBuffer();
       if (bb == null) {
         fail("could not create a direct ByteBuffer for an off-heap Chunk");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b75d0400/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteSourceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteSourceJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteSourceJUnitTest.java
index 2c5e834..e82124e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteSourceJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/pdx/OffHeapByteSourceJUnitTest.java
@@ -20,7 +20,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.experimental.categories.Category;
 
-import com.gemstone.gemfire.internal.offheap.ObjectChunk;
+import com.gemstone.gemfire.internal.offheap.ObjectStoredInMemory;
 import com.gemstone.gemfire.internal.offheap.NullOffHeapMemoryStats;
 import com.gemstone.gemfire.internal.offheap.NullOutOfOffHeapMemoryListener;
 import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
@@ -52,9 +52,9 @@ public class OffHeapByteSourceJUnitTest extends ByteSourceJUnitTest {
   @Override
   protected ByteSource createByteSource(byte[] bytes) {
     StoredObject so = SimpleMemoryAllocatorImpl.getAllocator().allocateAndInitialize(bytes,
false, false);
-    if (so instanceof ObjectChunk) {
+    if (so instanceof ObjectStoredInMemory) {
       // bypass the factory to make sure that OffHeapByteSource is tested
-      return new OffHeapByteSource((ObjectChunk)so);
+      return new OffHeapByteSource((ObjectStoredInMemory)so);
     } else {
       // bytes are so small they can be encoded in a long (see DataAsAddress).
       // So for this test just wrap the original bytes.


Mime
View raw message