geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [39/52] [abbrv] incubator-geode git commit: added AddressableMemoryChunk interface and factory
Date Fri, 29 Jan 2016 01:16:56 GMT
added AddressableMemoryChunk interface and factory


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

Branch: refs/heads/feature/GEODE-831
Commit: 3ca7b3e2f15da237b50636b96e50a36fbb6d97b4
Parents: 0fdf64f
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Wed Jan 27 17:21:08 2016 -0800
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Wed Jan 27 17:21:08 2016 -0800

----------------------------------------------------------------------
 .../offheap/AddressableMemoryChunk.java         | 29 +++++++++
 .../offheap/AddressableMemoryChunkFactory.java  | 27 +++++++++
 .../gemfire/internal/offheap/Fragment.java      |  5 ++
 .../internal/offheap/FreeListManager.java       | 26 ++++----
 .../offheap/SimpleMemoryAllocatorImpl.java      | 14 ++---
 .../internal/offheap/UnsafeMemoryChunk.java     | 16 ++---
 .../internal/offheap/FreeListManagerTest.java   | 62 ++++++++++++++++++++
 .../offheap/SimpleMemoryAllocatorJUnitTest.java | 13 ++--
 .../offheap/UnsafeMemoryChunkJUnitTest.java     |  2 +-
 9 files changed, 155 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunk.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunk.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunk.java
new file mode 100644
index 0000000..7916e1f
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunk.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.offheap;
+
+/**
+ * A memory chunk that also has an address of its memory.
+ */
+public interface AddressableMemoryChunk extends MemoryChunk {
+
+  /**
+   * Return the address of the memory of this chunk.
+   */
+  public long getMemoryAddress();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunkFactory.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunkFactory.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunkFactory.java
new file mode 100644
index 0000000..fa2dd78
--- /dev/null
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/AddressableMemoryChunkFactory.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.offheap;
+
+/**
+ * Used to create AddressableMemoryChunk instances.
+ */
+public interface AddressableMemoryChunkFactory {
+  /** Create and return an AddressableMemoryChunk.
+   * @throws OutOfMemoryError if the create fails
+   */
+  public AddressableMemoryChunk create(int size);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/Fragment.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/Fragment.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/Fragment.java
index eda864c..d178198 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/Fragment.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/Fragment.java
@@ -131,4 +131,9 @@ public class Fragment implements MemoryBlock {
     long value = this.getMemoryAddress();
     return (int)(value ^ (value >>> 32));
   }
+  @Override
+  public String toString() {
+    return "Fragment [baseAddr=" + baseAddr + ", size=" + size + ", freeIdx=" + freeIdx +
"]";
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
index 9d759f5..586689f 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/FreeListManager.java
@@ -40,7 +40,7 @@ public class FreeListManager {
   /** The MemoryChunks that this allocator is managing by allocating smaller chunks of them.
    * The contents of this array never change.
    */
-  private final UnsafeMemoryChunk[] slabs;
+  private final AddressableMemoryChunk[] slabs;
   private final long totalSlabSize;
   
   final private AtomicReferenceArray<SyncChunkStack> tinyFreeLists = new AtomicReferenceArray<SyncChunkStack>(TINY_FREE_LIST_COUNT);
@@ -58,7 +58,7 @@ public class FreeListManager {
     }
     return result;
   }
-  private void getLiveChunks(UnsafeMemoryChunk slab, List<Chunk> result) {
+  private void getLiveChunks(AddressableMemoryChunk slab, List<Chunk> result) {
     long addr = slab.getMemoryAddress();
     while (addr <= (slab.getMemoryAddress() + slab.getSize() - Chunk.MIN_CHUNK_SIZE))
{
       Fragment f = isAddrInFragmentFreeSpace(addr);
@@ -126,7 +126,7 @@ public class FreeListManager {
   private final CopyOnWriteArrayList<Fragment> fragmentList;
   private final SimpleMemoryAllocatorImpl ma;
 
-  public FreeListManager(SimpleMemoryAllocatorImpl ma, final UnsafeMemoryChunk[] slabs) {
+  public FreeListManager(SimpleMemoryAllocatorImpl ma, final AddressableMemoryChunk[] slabs)
{
     this.ma = ma;
     this.slabs = slabs;
     long total = 0;
@@ -479,6 +479,9 @@ public class FreeListManager {
     collectFreeHugeChunks(l);
     collectFreeTinyChunks(l);
   }
+  List<Fragment> getFragmentList() {
+    return this.fragmentList;
+  }
   private void collectFreeFragmentChunks(List<SyncChunkStack> l) {
     if (this.fragmentList.size() == 0) return;
     SyncChunkStack result = new SyncChunkStack();
@@ -490,14 +493,11 @@ public class FreeListManager {
         diff = f.getSize() - offset;
       } while (diff >= Chunk.MIN_CHUNK_SIZE && !f.allocate(offset, offset+diff));
       if (diff < Chunk.MIN_CHUNK_SIZE) {
-        if (diff > 0) {
-          SimpleMemoryAllocatorImpl.logger.debug("Lost memory of size {}", diff);
-        }
-        // fragment is too small to turn into a chunk
-        // TODO we need to make sure this never happens
-        // by keeping sizes rounded. I think I did this
-        // by introducing MIN_CHUNK_SIZE and by rounding
-        // the size of huge allocations.
+        // If diff > 0 then that memory will be lost during compaction.
+        // This should never happen since we keep the sizes rounded
+        // based on MIN_CHUNK_SIZE.
+        assert diff == 0;
+        // The current fragment is completely allocated so just skip it.
         continue;
       }
       long chunkAddr = f.getMemoryAddress()+offset;
@@ -861,7 +861,7 @@ public class FreeListManager {
    * be used. Note that this code does not bother
    * comparing the contents of the arrays.
    */
-  boolean okToReuse(UnsafeMemoryChunk[] newSlabs) {
+  boolean okToReuse(AddressableMemoryChunk[] newSlabs) {
     return newSlabs == null || newSlabs == this.slabs;
   }
   
@@ -870,7 +870,7 @@ public class FreeListManager {
   }
   int findSlab(long addr) {
     for (int i=0; i < this.slabs.length; i++) {
-      UnsafeMemoryChunk slab = this.slabs[i];
+      AddressableMemoryChunk slab = this.slabs[i];
       long slabAddr = slab.getMemoryAddress();
       if (addr >= slabAddr) {
         if (addr < slabAddr + slab.getSize()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
index 122b23c..6b3a730 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorImpl.java
@@ -90,9 +90,9 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
   public static MemoryAllocator create(OutOfOffHeapMemoryListener ooohml, OffHeapMemoryStats
stats, LogWriter lw, 
       int slabCount, long offHeapMemorySize, long maxSlabSize) {
     return create(ooohml, stats, lw, slabCount, offHeapMemorySize, maxSlabSize,
-        null, new UnsafeMemoryChunk.Factory() {
+        null, new AddressableMemoryChunkFactory() {
       @Override
-      public UnsafeMemoryChunk create(int size) {
+      public AddressableMemoryChunk create(int size) {
         return new UnsafeMemoryChunk(size);
       }
     });
@@ -100,7 +100,7 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
 
   private static SimpleMemoryAllocatorImpl create(OutOfOffHeapMemoryListener ooohml, OffHeapMemoryStats
stats, LogWriter lw, 
       int slabCount, long offHeapMemorySize, long maxSlabSize, 
-      UnsafeMemoryChunk[] slabs, UnsafeMemoryChunk.Factory memChunkFactory) {
+      AddressableMemoryChunk[] slabs, AddressableMemoryChunkFactory memChunkFactory) {
     SimpleMemoryAllocatorImpl result = singleton;
     boolean created = false;
     try {
@@ -163,11 +163,11 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
     return result;
   }
   static SimpleMemoryAllocatorImpl createForUnitTest(OutOfOffHeapMemoryListener ooohml, OffHeapMemoryStats
stats, LogWriter lw, 
-      int slabCount, long offHeapMemorySize, long maxSlabSize, UnsafeMemoryChunk.Factory
memChunkFactory) {
+      int slabCount, long offHeapMemorySize, long maxSlabSize, AddressableMemoryChunkFactory
memChunkFactory) {
     return create(ooohml, stats, lw, slabCount, offHeapMemorySize, maxSlabSize, 
         null, memChunkFactory);
   }
-  public static SimpleMemoryAllocatorImpl createForUnitTest(OutOfOffHeapMemoryListener oooml,
OffHeapMemoryStats stats, UnsafeMemoryChunk[] slabs) {
+  public static SimpleMemoryAllocatorImpl createForUnitTest(OutOfOffHeapMemoryListener oooml,
OffHeapMemoryStats stats, AddressableMemoryChunk[] slabs) {
     int slabCount = 0;
     long offHeapMemorySize = 0;
     long maxSlabSize = 0;
@@ -185,7 +185,7 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
   }
   
   
-  private void reuse(OutOfOffHeapMemoryListener oooml, LogWriter lw, OffHeapMemoryStats newStats,
long offHeapMemorySize, UnsafeMemoryChunk[] slabs) {
+  private void reuse(OutOfOffHeapMemoryListener oooml, LogWriter lw, OffHeapMemoryStats newStats,
long offHeapMemorySize, AddressableMemoryChunk[] slabs) {
     if (isClosed()) {
       throw new IllegalStateException("Can not reuse a closed off-heap memory manager.");
     }
@@ -205,7 +205,7 @@ public class SimpleMemoryAllocatorImpl implements MemoryAllocator {
     this.stats = newStats;
   }
 
-  private SimpleMemoryAllocatorImpl(final OutOfOffHeapMemoryListener oooml, final OffHeapMemoryStats
stats, final UnsafeMemoryChunk[] slabs) {
+  private SimpleMemoryAllocatorImpl(final OutOfOffHeapMemoryListener oooml, final OffHeapMemoryStats
stats, final AddressableMemoryChunk[] slabs) {
     if (oooml == null) {
       throw new IllegalArgumentException("OutOfOffHeapMemoryListener is null");
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunk.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunk.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunk.java
index ed1c843..aebc459 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunk.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunk.java
@@ -25,7 +25,7 @@ import com.gemstone.gemfire.pdx.internal.unsafe.UnsafeWrapper;
  * 
  * @since 9.0
  */
-public class UnsafeMemoryChunk implements MemoryChunk {
+public class UnsafeMemoryChunk implements AddressableMemoryChunk {
   private static final UnsafeWrapper unsafe;
   private static final int ARRAY_BYTE_BASE_OFFSET;
   private static String reason;
@@ -70,6 +70,10 @@ public class UnsafeMemoryChunk implements MemoryChunk {
     return (int)this.size;
   }
   
+  /* (non-Javadoc)
+   * @see com.gemstone.gemfire.internal.offheap.AddressableMemoryChunk#getMemoryAddress()
+   */
+  @Override
   public long getMemoryAddress() {
     return this.data;
   }
@@ -210,14 +214,4 @@ public class UnsafeMemoryChunk implements MemoryChunk {
     sb.append("}");
     return sb.toString();
   }
-  
-  /**
-   * Used to create UnsafeMemoryChunk instances.
-   */
-  public interface Factory {
-    /** Create and return an UnsafeMemoryChunk.
-     * @throws OutOfMemoryError if the create fails
-     */
-    public UnsafeMemoryChunk create(int size);
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
index 4667ac5..73b0e37 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/FreeListManagerTest.java
@@ -272,9 +272,71 @@ public class FreeListManagerTest {
     }
     
     assertThat(this.freeListManager.compact(DEFAULT_SLAB_SIZE)).isTrue();
+    assertThat(this.freeListManager.getFragmentList()).hasSize(4);
   }
   
   @Test
+  public void compactWithLiveChunks() {
+    int SMALL_SLAB = 16;
+    int MEDIUM_SLAB = 128;
+    this.freeListManager = new FreeListManager(ma, new UnsafeMemoryChunk[] {
+        new UnsafeMemoryChunk(SMALL_SLAB), 
+        new UnsafeMemoryChunk(SMALL_SLAB), 
+        new UnsafeMemoryChunk(MEDIUM_SLAB), 
+        slab});
+    ArrayList<Chunk> chunks = new ArrayList<>();
+    chunks.add(this.freeListManager.allocate(SMALL_SLAB-8+1));
+    this.freeListManager.allocate(DEFAULT_SLAB_SIZE/2-8);
+    chunks.add(this.freeListManager.allocate(DEFAULT_SLAB_SIZE/2-8));
+    this.freeListManager.allocate(SMALL_SLAB-8+1);
+    for (Chunk c: chunks) {
+      Chunk.release(c.getMemoryAddress(), this.freeListManager);
+    }
+    
+    assertThat(this.freeListManager.compact(DEFAULT_SLAB_SIZE/2)).isTrue();
+  }
+  
+  @Test
+  public void compactAfterAllocatingAll() {
+    setUpSingleSlabManager();
+    Chunk c = freeListManager.allocate(DEFAULT_SLAB_SIZE-8);
+    
+    assertThat(this.freeListManager.compact(1)).isFalse();
+    // call compact twice for extra code coverage
+    assertThat(this.freeListManager.compact(1)).isFalse();
+    assertThat(this.freeListManager.getFragmentList()).isEmpty();
+  }
+  
+  @Test
+  public void compactWithEmptyTinyFreeList() {
+    setUpSingleSlabManager();
+    Fragment originalFragment = this.freeListManager.getFragmentList().get(0);
+    Chunk c = freeListManager.allocate(16);
+    Chunk.release(c.getMemoryAddress(), this.freeListManager);
+    c = freeListManager.allocate(16);
+    
+    assertThat(this.freeListManager.compact(1)).isTrue();
+    assertThat(this.freeListManager.getFragmentList()).hasSize(1);
+    Fragment compactedFragment = this.freeListManager.getFragmentList().get(0);
+    assertThat(compactedFragment.getSize()).isEqualTo(originalFragment.getSize()-(16+8));
+    assertThat(compactedFragment.getMemoryAddress()).isEqualTo(originalFragment.getMemoryAddress()+(16+8));
+  }
+  
+  @Test
+  public void allocationsThatLeaveLessThanMinChunkSizeFreeInAFragment() {
+    int SMALL_SLAB = 16;
+    int MEDIUM_SLAB = 128;
+    this.freeListManager = new FreeListManager(ma, new UnsafeMemoryChunk[] {
+        new UnsafeMemoryChunk(SMALL_SLAB), 
+        new UnsafeMemoryChunk(SMALL_SLAB), 
+        new UnsafeMemoryChunk(MEDIUM_SLAB), 
+        slab});
+    this.freeListManager.allocate(DEFAULT_SLAB_SIZE-8-(Chunk.MIN_CHUNK_SIZE-1));
+    this.freeListManager.allocate(MEDIUM_SLAB-8-(Chunk.MIN_CHUNK_SIZE-1));
+    
+    assertThat(this.freeListManager.compact(SMALL_SLAB)).isTrue();
+  }
+ @Test
   public void maxAllocationUsesAllMemory() {
     setUpSingleSlabManager();
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
index 2a51c21..2f47509 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/SimpleMemoryAllocatorJUnitTest.java
@@ -32,7 +32,6 @@ import org.junit.experimental.categories.Category;
 import com.gemstone.gemfire.OutOfOffHeapMemoryException;
 import com.gemstone.gemfire.cache.CacheClosedException;
 import com.gemstone.gemfire.internal.logging.NullLogWriter;
-import com.gemstone.gemfire.internal.offheap.UnsafeMemoryChunk.Factory;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
@@ -98,9 +97,9 @@ public class SimpleMemoryAllocatorJUnitTest {
       LastSevereLogger logger = new LastSevereLogger();
       try {
         SimpleMemoryAllocatorImpl.createForUnitTest(listener, stats, logger, 10, 950, 100,
-            new UnsafeMemoryChunk.Factory() {
+            new AddressableMemoryChunkFactory() {
           @Override
-          public UnsafeMemoryChunk create(int size) {
+          public AddressableMemoryChunk create(int size) {
             throw new OutOfMemoryError("expected");
           }
         });
@@ -117,10 +116,10 @@ public class SimpleMemoryAllocatorJUnitTest {
       LastSevereLogger logger = new LastSevereLogger();
       int MAX_SLAB_SIZE = 100;
       try {
-        Factory factory = new UnsafeMemoryChunk.Factory() {
+        AddressableMemoryChunkFactory factory = new AddressableMemoryChunkFactory() {
           private int createCount = 0;
           @Override
-          public UnsafeMemoryChunk create(int size) {
+          public AddressableMemoryChunk create(int size) {
             createCount++;
             if (createCount == 1) {
               return new UnsafeMemoryChunk(size);
@@ -140,9 +139,9 @@ public class SimpleMemoryAllocatorJUnitTest {
     {
       NullOutOfOffHeapMemoryListener listener = new NullOutOfOffHeapMemoryListener();
       NullOffHeapMemoryStats stats = new NullOffHeapMemoryStats();
-      Factory factory = new UnsafeMemoryChunk.Factory() {
+      AddressableMemoryChunkFactory factory = new AddressableMemoryChunkFactory() {
         @Override
-        public UnsafeMemoryChunk create(int size) {
+        public AddressableMemoryChunk create(int size) {
           return new UnsafeMemoryChunk(size);
         }
       };

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/3ca7b3e2/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunkJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunkJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunkJUnitTest.java
index a98fa28..d7168a7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunkJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/offheap/UnsafeMemoryChunkJUnitTest.java
@@ -35,7 +35,7 @@ public class UnsafeMemoryChunkJUnitTest extends MemoryChunkJUnitTestBase
{
   public void testGetAddress() {
     MemoryChunk mc = createChunk(1024);
     try {
-      UnsafeMemoryChunk umc = (UnsafeMemoryChunk) mc;
+      AddressableMemoryChunk umc = (AddressableMemoryChunk) mc;
       assertNotEquals(0, umc.getMemoryAddress());
     } finally {
       mc.release();


Mime
View raw message