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

[38/38] incubator-geode git commit: renamed SyncChunkStack to OffHeapStoredObjectAddressStack

renamed SyncChunkStack to OffHeapStoredObjectAddressStack


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

Branch: refs/heads/feature/GEODE-982
Commit: 6a6c85ce3fbf3283c5598a165b3abc41f8da6f3f
Parents: 344c64f
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Fri Mar 4 16:46:33 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Fri Mar 4 16:46:33 2016 -0800

----------------------------------------------------------------------
 .../internal/offheap/FreeListManager.java       |  40 +--
 .../OffHeapStoredObjectAddressStack.java        | 141 +++++++++
 .../internal/offheap/SyncChunkStack.java        | 141 ---------
 .../internal/offheap/FreeListManagerTest.java   |   4 +-
 ...ffHeapStoredObjectAddressStackJUnitTest.java | 289 +++++++++++++++++++
 .../offheap/SyncChunkStackJUnitTest.java        | 289 -------------------
 6 files changed, 452 insertions(+), 452 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/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 06ec108..ed7035a 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
@@ -43,7 +43,7 @@ public class FreeListManager {
   private final Slab[] slabs;
   private final long totalSlabSize;
   
-  final private AtomicReferenceArray<SyncChunkStack> tinyFreeLists = new AtomicReferenceArray<SyncChunkStack>(TINY_FREE_LIST_COUNT);
+  final private AtomicReferenceArray<OffHeapStoredObjectAddressStack> tinyFreeLists = new AtomicReferenceArray<OffHeapStoredObjectAddressStack>(TINY_FREE_LIST_COUNT);
   // hugeChunkSet is sorted by chunk size in ascending order. It will only contain chunks larger than MAX_TINY.
   private final ConcurrentSkipListSet<OffHeapStoredObject> hugeChunkSet = new ConcurrentSkipListSet<OffHeapStoredObject>();
   private final AtomicLong allocatedSize = new AtomicLong(0L);
@@ -104,7 +104,7 @@ public class FreeListManager {
   long getFreeTinyMemory() {
     long tinyFree = 0;
     for (int i=0; i < this.tinyFreeLists.length(); i++) {
-      SyncChunkStack cl = this.tinyFreeLists.get(i);
+      OffHeapStoredObjectAddressStack cl = this.tinyFreeLists.get(i);
       if (cl != null) {
         tinyFree += cl.computeTotalSize();
       }
@@ -253,7 +253,7 @@ public class FreeListManager {
   }
   private void logTinyState(LogWriter lw) {
     for (int i=0; i < this.tinyFreeLists.length(); i++) {
-      SyncChunkStack cl = this.tinyFreeLists.get(i);
+      OffHeapStoredObjectAddressStack cl = this.tinyFreeLists.get(i);
       if (cl != null) {
         cl.logSizes(lw, "Free tiny of size ");
       }
@@ -323,14 +323,14 @@ public class FreeListManager {
           // So just return true causing the caller to retry the allocation.
           return true;
         }
-        ArrayList<SyncChunkStack> freeChunks = new ArrayList<SyncChunkStack>();
+        ArrayList<OffHeapStoredObjectAddressStack> freeChunks = new ArrayList<OffHeapStoredObjectAddressStack>();
         collectFreeChunks(freeChunks);
         final int SORT_ARRAY_BLOCK_SIZE = 128;
         long[] sorted = new long[SORT_ARRAY_BLOCK_SIZE];
         int sortedSize = 0;
         boolean result = false;
         int largestFragment = 0;
-        for (SyncChunkStack l: freeChunks) {
+        for (OffHeapStoredObjectAddressStack l: freeChunks) {
           long addr = l.poll();
           while (addr != 0) {
             int idx = Arrays.binarySearch(sorted, 0, sortedSize, addr);
@@ -500,7 +500,7 @@ public class FreeListManager {
     }
   }
 
-  private void collectFreeChunks(List<SyncChunkStack> l) {
+  private void collectFreeChunks(List<OffHeapStoredObjectAddressStack> l) {
     collectFreeFragmentChunks(l);
     collectFreeHugeChunks(l);
     collectFreeTinyChunks(l);
@@ -508,9 +508,9 @@ public class FreeListManager {
   List<Fragment> getFragmentList() {
     return this.fragmentList;
   }
-  private void collectFreeFragmentChunks(List<SyncChunkStack> l) {
+  private void collectFreeFragmentChunks(List<OffHeapStoredObjectAddressStack> l) {
     if (this.fragmentList.size() == 0) return;
-    SyncChunkStack result = new SyncChunkStack();
+    OffHeapStoredObjectAddressStack result = new OffHeapStoredObjectAddressStack();
     for (Fragment f: this.fragmentList) {
       int offset;
       int diff;
@@ -537,23 +537,23 @@ public class FreeListManager {
       l.add(result);
     }
   }
-  private void collectFreeTinyChunks(List<SyncChunkStack> l) {
+  private void collectFreeTinyChunks(List<OffHeapStoredObjectAddressStack> l) {
     for (int i=0; i < this.tinyFreeLists.length(); i++) {
-      SyncChunkStack cl = this.tinyFreeLists.get(i);
+      OffHeapStoredObjectAddressStack cl = this.tinyFreeLists.get(i);
       if (cl != null) {
         long head = cl.clear();
         if (head != 0L) {
-          l.add(new SyncChunkStack(head));
+          l.add(new OffHeapStoredObjectAddressStack(head));
         }
       }
     }
   }
-  private void collectFreeHugeChunks(List<SyncChunkStack> l) {
+  private void collectFreeHugeChunks(List<OffHeapStoredObjectAddressStack> l) {
     OffHeapStoredObject c = this.hugeChunkSet.pollFirst();
-    SyncChunkStack result = null;
+    OffHeapStoredObjectAddressStack result = null;
     while (c != null) {
       if (result == null) {
-        result = new SyncChunkStack();
+        result = new OffHeapStoredObjectAddressStack();
         l.add(result);
       }
       result.offer(c.getAddress());
@@ -612,8 +612,8 @@ public class FreeListManager {
   private OffHeapStoredObject allocateTiny(int size, boolean useFragments) {
     return basicAllocate(getNearestTinyMultiple(size), TINY_MULTIPLE, 0, this.tinyFreeLists, useFragments);
   }
-  private OffHeapStoredObject basicAllocate(int idx, int multiple, int offset, AtomicReferenceArray<SyncChunkStack> freeLists, boolean useFragments) {
-    SyncChunkStack clq = freeLists.get(idx);
+  private OffHeapStoredObject basicAllocate(int idx, int multiple, int offset, AtomicReferenceArray<OffHeapStoredObjectAddressStack> freeLists, boolean useFragments) {
+    OffHeapStoredObjectAddressStack clq = freeLists.get(idx);
     if (clq != null) {
       long memAddr = clq.poll();
       if (memAddr != 0) {
@@ -703,8 +703,8 @@ public class FreeListManager {
   private void freeTiny(long addr, int cSize) {
     basicFree(addr, getNearestTinyMultiple(cSize), this.tinyFreeLists);
   }
-  private void basicFree(long addr, int idx, AtomicReferenceArray<SyncChunkStack> freeLists) {
-    SyncChunkStack clq = freeLists.get(idx);
+  private void basicFree(long addr, int idx, AtomicReferenceArray<OffHeapStoredObjectAddressStack> freeLists) {
+    OffHeapStoredObjectAddressStack clq = freeLists.get(idx);
     if (clq != null) {
       clq.offer(addr);
     } else {
@@ -719,8 +719,8 @@ public class FreeListManager {
   /**
    * Tests override this method to simulate concurrent modification
    */
-  protected SyncChunkStack createFreeListForEmptySlot(AtomicReferenceArray<SyncChunkStack> freeLists, int idx) {
-    return new SyncChunkStack();
+  protected OffHeapStoredObjectAddressStack createFreeListForEmptySlot(AtomicReferenceArray<OffHeapStoredObjectAddressStack> freeLists, int idx) {
+    return new OffHeapStoredObjectAddressStack();
   }
   
   private void freeHuge(long addr, int cSize) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStack.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStack.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStack.java
new file mode 100644
index 0000000..bde30e2
--- /dev/null
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStack.java
@@ -0,0 +1,141 @@
+/*
+ * 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;
+
+import com.gemstone.gemfire.LogWriter;
+
+/**
+ * A "stack" of addresses of OffHeapStoredObject instances. The stored objects are not kept
+ * in java object form but instead each one is just an off-heap address.
+ * This class is used for each "tiny" free-list of the FreeListManager.
+ * This class is thread safe.
+ */
+public class OffHeapStoredObjectAddressStack {
+  // Ok to read without sync but must be synced on write
+  private volatile long topAddr;
+  
+  public OffHeapStoredObjectAddressStack(long addr) {
+    if (addr != 0L) SimpleMemoryAllocatorImpl.validateAddress(addr);
+    this.topAddr = addr;
+  }
+  public OffHeapStoredObjectAddressStack() {
+    this.topAddr = 0L;
+  }
+  public boolean isEmpty() {
+    return this.topAddr == 0L;
+  }
+  public void offer(long e) {
+    assert e != 0;
+    SimpleMemoryAllocatorImpl.validateAddress(e);
+    synchronized (this) {
+      OffHeapStoredObject.setNext(e, this.topAddr);
+      this.topAddr = e;
+    }
+  }
+  public long poll() {
+    long result;
+    synchronized (this) {
+      result = this.topAddr;
+      if (result != 0L) {
+        this.topAddr = OffHeapStoredObject.getNext(result);
+      }
+    }
+    return result;
+  }
+  /**
+   * Returns the address of the "top" item in this stack.
+   */
+  public long getTopAddress() {
+    return this.topAddr;
+  }
+  /**
+   * Removes all the addresses from this stack
+   * and returns the top address.
+   * The caller owns all the addresses after this call.
+   */
+  public long clear() {
+    long result;
+    synchronized (this) {
+      result = this.topAddr;
+      if (result != 0L) {
+        this.topAddr = 0L;
+      }
+    }
+    return result;
+  }
+  public void logSizes(LogWriter lw, String msg) {
+    long headAddr = this.topAddr;
+    long addr;
+    boolean concurrentModDetected;
+    do {
+      concurrentModDetected = false;
+      addr = headAddr;
+      while (addr != 0L) {
+        int curSize = OffHeapStoredObject.getSize(addr);
+        addr = OffHeapStoredObject.getNext(addr);
+        testHookDoConcurrentModification();
+        long curHead = this.topAddr;
+        if (curHead != headAddr) {
+          headAddr = curHead;
+          concurrentModDetected = true;
+          // Someone added or removed from the stack.
+          // So we break out of the inner loop and start
+          // again at the new head.
+          break;
+        }
+        // TODO construct a single log msg
+        // that gets reset when concurrentModDetected.
+        lw.info(msg + curSize);
+      }
+    } while (concurrentModDetected);
+  }
+  public long computeTotalSize() {
+    long result;
+    long headAddr = this.topAddr;
+    long addr;
+    boolean concurrentModDetected;
+    do {
+      concurrentModDetected = false;
+      result = 0;
+      addr = headAddr;
+      while (addr != 0L) {
+        result += OffHeapStoredObject.getSize(addr);
+        addr = OffHeapStoredObject.getNext(addr);
+        testHookDoConcurrentModification();
+        long curHead = this.topAddr;
+        if (curHead != headAddr) {
+          headAddr = curHead;
+          concurrentModDetected = true;
+          // Someone added or removed from the stack.
+          // So we break out of the inner loop and start
+          // again at the new head.
+          break;
+        }
+      }
+    } while (concurrentModDetected);
+    return result;
+  }
+  
+  /**
+   * This method allows tests to override it
+   * and do a concurrent modification to the stack.
+   * For production code it will be a noop.
+   */
+  protected void testHookDoConcurrentModification() {
+    // nothing needed in production code
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SyncChunkStack.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SyncChunkStack.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SyncChunkStack.java
deleted file mode 100644
index 83cb7df..0000000
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/offheap/SyncChunkStack.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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;
-
-import com.gemstone.gemfire.LogWriter;
-
-/**
- * A "stack" of "chunk" instances. The chunks are not kept
- * in java object form but instead each "chunk" is just an
- * off-heap address.
- * This class is used for each "tiny" free-list of the off-heap memory allocator.
- */
-public class SyncChunkStack {
-  // Ok to read without sync but must be synced on write
-  private volatile long topAddr;
-  
-  public SyncChunkStack(long addr) {
-    if (addr != 0L) SimpleMemoryAllocatorImpl.validateAddress(addr);
-    this.topAddr = addr;
-  }
-  public SyncChunkStack() {
-    this.topAddr = 0L;
-  }
-  public boolean isEmpty() {
-    return this.topAddr == 0L;
-  }
-  public void offer(long e) {
-    assert e != 0;
-    SimpleMemoryAllocatorImpl.validateAddress(e);
-    synchronized (this) {
-      OffHeapStoredObject.setNext(e, this.topAddr);
-      this.topAddr = e;
-    }
-  }
-  public long poll() {
-    long result;
-    synchronized (this) {
-      result = this.topAddr;
-      if (result != 0L) {
-        this.topAddr = OffHeapStoredObject.getNext(result);
-      }
-    }
-    return result;
-  }
-  /**
-   * Returns the address of the "top" item in this stack.
-   */
-  public long getTopAddress() {
-    return this.topAddr;
-  }
-  /**
-   * Removes all the Chunks from this stack
-   * and returns the address of the first chunk.
-   * The caller owns all the Chunks after this call.
-   */
-  public long clear() {
-    long result;
-    synchronized (this) {
-      result = this.topAddr;
-      if (result != 0L) {
-        this.topAddr = 0L;
-      }
-    }
-    return result;
-  }
-  public void logSizes(LogWriter lw, String msg) {
-    long headAddr = this.topAddr;
-    long addr;
-    boolean concurrentModDetected;
-    do {
-      concurrentModDetected = false;
-      addr = headAddr;
-      while (addr != 0L) {
-        int curSize = OffHeapStoredObject.getSize(addr);
-        addr = OffHeapStoredObject.getNext(addr);
-        testHookDoConcurrentModification();
-        long curHead = this.topAddr;
-        if (curHead != headAddr) {
-          headAddr = curHead;
-          concurrentModDetected = true;
-          // Someone added or removed from the stack.
-          // So we break out of the inner loop and start
-          // again at the new head.
-          break;
-        }
-        // TODO construct a single log msg
-        // that gets reset when concurrentModDetected.
-        lw.info(msg + curSize);
-      }
-    } while (concurrentModDetected);
-  }
-  public long computeTotalSize() {
-    long result;
-    long headAddr = this.topAddr;
-    long addr;
-    boolean concurrentModDetected;
-    do {
-      concurrentModDetected = false;
-      result = 0;
-      addr = headAddr;
-      while (addr != 0L) {
-        result += OffHeapStoredObject.getSize(addr);
-        addr = OffHeapStoredObject.getNext(addr);
-        testHookDoConcurrentModification();
-        long curHead = this.topAddr;
-        if (curHead != headAddr) {
-          headAddr = curHead;
-          concurrentModDetected = true;
-          // Someone added or removed from the stack.
-          // So we break out of the inner loop and start
-          // again at the new head.
-          break;
-        }
-      }
-    } while (concurrentModDetected);
-    return result;
-  }
-  
-  /**
-   * This method allows tests to override it
-   * and do a concurrent modification to the stack.
-   * For production code it will be a noop.
-   */
-  protected void testHookDoConcurrentModification() {
-    // nothing needed in production code
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/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 8beb6c8..3787129 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
@@ -851,10 +851,10 @@ public class FreeListManagerTest {
     }
 
     @Override
-    protected SyncChunkStack createFreeListForEmptySlot(AtomicReferenceArray<SyncChunkStack> freeLists, int idx) {
+    protected OffHeapStoredObjectAddressStack createFreeListForEmptySlot(AtomicReferenceArray<OffHeapStoredObjectAddressStack> freeLists, int idx) {
       if (this.firstTime) {
         this.firstTime = false;
-        SyncChunkStack clq = super.createFreeListForEmptySlot(freeLists, idx);
+        OffHeapStoredObjectAddressStack clq = super.createFreeListForEmptySlot(freeLists, idx);
         if (!freeLists.compareAndSet(idx, null, clq)) {
           fail("this should never happen. Indicates a concurrent modification");
         }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
new file mode 100644
index 0000000..8040bf7
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OffHeapStoredObjectAddressStackJUnitTest.java
@@ -0,0 +1,289 @@
+/*
+ * 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;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.listeners.InvocationListener;
+import org.mockito.listeners.MethodInvocationReport;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class OffHeapStoredObjectAddressStackJUnitTest {
+  static {
+    ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
+  }
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+  }
+
+  @AfterClass
+  public static void tearDownAfterClass() throws Exception {
+  }
+
+  @Before
+  public void setUp() throws Exception {
+  }
+
+  @After
+  public void tearDown() throws Exception {
+  }
+
+  @Test
+  public void addressZeroCausesStackToBeEmpty() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack(0L);
+    assertEquals(true, stack.isEmpty());
+  }
+
+  @Test
+  public void defaultStackIsEmpty() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    assertEquals(true, stack.isEmpty());
+  }
+
+  @Test
+  public void defaultStackReturnsZeroFromTop() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    assertEquals(0L, stack.getTopAddress());
+  }
+  
+  @Test
+  public void defaultStackReturnsZeroFromPoll() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    assertEquals(0L, stack.poll());
+  }
+  
+  @Test
+  public void defaultStackReturnsZeroFromClear() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    assertEquals(0L, stack.clear());
+    assertEquals(true, stack.isEmpty());
+  }
+  
+  @Test
+  public void defaultStackLogsNothing() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    LogWriter lw = mock(LogWriter.class, withSettings().invocationListeners(new InvocationListener() {
+      @Override
+      public void reportInvocation(MethodInvocationReport methodInvocationReport) {
+        fail("Unexpected invocation");
+      }
+    }));
+    stack.logSizes(lw, "should not be used");
+  }
+  
+  @Test
+  public void defaultStackComputeSizeIsZero() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+    assertEquals(0L, stack.computeTotalSize());
+  }
+  
+  @Test
+  public void stackCreatedWithAddressIsNotEmpty() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack(chunk.getAddress());
+      assertEquals(false, stack.isEmpty());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+  @Test
+  public void stackWithChunkIsNotEmpty() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(chunk.getAddress());
+      assertEquals(false, stack.isEmpty());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+  @Test
+  public void stackWithChunkTopEqualsAddress() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+
+      long addr = chunk.getAddress();
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(addr);
+      assertEquals(addr, stack.getTopAddress());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+  @Test
+  public void addressZeroOfferCausesFailedAssertion() {
+    OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack(0L);
+    try {
+      stack.offer(0);
+      fail("expected AssertionError");
+    } catch (AssertionError expected) {
+    }
+  }
+
+
+  @Test
+  public void stackWithChunkClearReturnsAddressAndEmptiesStack() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+
+      long addr = chunk.getAddress();
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(addr);
+      long clearAddr = stack.clear();
+      assertEquals(addr, clearAddr);
+      assertEquals(true, stack.isEmpty());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+  @Test
+  public void stackWithChunkPollReturnsAddressAndEmptiesStack() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+
+      long addr = chunk.getAddress();
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(addr);
+      long pollAddr = stack.poll();
+      assertEquals(addr, pollAddr);
+      assertEquals(true, stack.isEmpty());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+  @Test
+  public void stackWithChunkTotalSizeIsChunkSize() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+      int chunkSize = chunk.getSize();
+
+      long addr = chunk.getAddress();
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(addr);
+      assertEquals(chunkSize, stack.computeTotalSize());
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+
+  @Test
+  public void stackWithChunkLogShowsMsgAndSize() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+      int chunkSize = chunk.getSize();
+
+      long addr = chunk.getAddress();
+      OffHeapStoredObjectAddressStack stack = new OffHeapStoredObjectAddressStack();
+      stack.offer(addr);
+      LogWriter lw = mock(LogWriter.class);
+      stack.logSizes(lw, "foo");
+      verify(lw).info("foo"+chunkSize);
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+  
+  private class TestableSyncChunkStack extends OffHeapStoredObjectAddressStack {
+    public boolean doConcurrentMod = true;
+    public int chunk2Size;
+    private SimpleMemoryAllocatorImpl ma;
+    TestableSyncChunkStack(SimpleMemoryAllocatorImpl ma) {
+      this.ma = ma;
+    }
+    @Override
+    protected void testHookDoConcurrentModification() {
+      if (doConcurrentMod) {
+        doConcurrentMod = false;
+        OffHeapStoredObject chunk2 = (OffHeapStoredObject) ma.allocate(50);
+        this.chunk2Size = chunk2.getSize();
+        this.offer(chunk2.getAddress());
+      }
+    }
+  }
+  @Test
+  public void stackWithChunkTotalSizeIsChunkSizeWithConcurrentMod() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+      int chunkSize = chunk.getSize();
+
+      long addr = chunk.getAddress();
+      TestableSyncChunkStack stack = new TestableSyncChunkStack(ma);
+      stack.offer(addr);
+      long totalSize = stack.computeTotalSize();
+      assertEquals("chunkSize=" + chunkSize + " chunk2Size=" + stack.chunk2Size, chunkSize + stack.chunk2Size, totalSize);
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+
+
+  @Test
+  public void stackWithChunkLogShowsMsgAndSizeWithConcurrentMod() {
+    SlabImpl slab = new SlabImpl(1024);
+    try {
+      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
+      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
+      int chunkSize = chunk.getSize();
+
+      long addr = chunk.getAddress();
+      TestableSyncChunkStack stack = new TestableSyncChunkStack(ma);
+      stack.offer(addr);
+      LogWriter lw = mock(LogWriter.class);
+      stack.logSizes(lw, "foo");
+      verify(lw).info("foo"+chunkSize);
+      verify(lw).info("foo"+stack.chunk2Size);
+    } finally {
+      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6a6c85ce/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
deleted file mode 100644
index e8c82b7..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/SyncChunkStackJUnitTest.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * 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;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.mockito.listeners.InvocationListener;
-import org.mockito.listeners.MethodInvocationReport;
-
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class SyncChunkStackJUnitTest {
-  static {
-    ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
-  }
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {
-  }
-
-  @Before
-  public void setUp() throws Exception {
-  }
-
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  @Test
-  public void addressZeroCausesStackToBeEmpty() {
-    SyncChunkStack stack = new SyncChunkStack(0L);
-    assertEquals(true, stack.isEmpty());
-  }
-
-  @Test
-  public void defaultStackIsEmpty() {
-    SyncChunkStack stack = new SyncChunkStack();
-    assertEquals(true, stack.isEmpty());
-  }
-
-  @Test
-  public void defaultStackReturnsZeroFromTop() {
-    SyncChunkStack stack = new SyncChunkStack();
-    assertEquals(0L, stack.getTopAddress());
-  }
-  
-  @Test
-  public void defaultStackReturnsZeroFromPoll() {
-    SyncChunkStack stack = new SyncChunkStack();
-    assertEquals(0L, stack.poll());
-  }
-  
-  @Test
-  public void defaultStackReturnsZeroFromClear() {
-    SyncChunkStack stack = new SyncChunkStack();
-    assertEquals(0L, stack.clear());
-    assertEquals(true, stack.isEmpty());
-  }
-  
-  @Test
-  public void defaultStackLogsNothing() {
-    SyncChunkStack stack = new SyncChunkStack();
-    LogWriter lw = mock(LogWriter.class, withSettings().invocationListeners(new InvocationListener() {
-      @Override
-      public void reportInvocation(MethodInvocationReport methodInvocationReport) {
-        fail("Unexpected invocation");
-      }
-    }));
-    stack.logSizes(lw, "should not be used");
-  }
-  
-  @Test
-  public void defaultStackComputeSizeIsZero() {
-    SyncChunkStack stack = new SyncChunkStack();
-    assertEquals(0L, stack.computeTotalSize());
-  }
-  
-  @Test
-  public void stackCreatedWithAddressIsNotEmpty() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-
-      SyncChunkStack stack = new SyncChunkStack(chunk.getAddress());
-      assertEquals(false, stack.isEmpty());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-  @Test
-  public void stackWithChunkIsNotEmpty() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(chunk.getAddress());
-      assertEquals(false, stack.isEmpty());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-  @Test
-  public void stackWithChunkTopEqualsAddress() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-
-      long addr = chunk.getAddress();
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(addr);
-      assertEquals(addr, stack.getTopAddress());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-  @Test
-  public void addressZeroOfferCausesFailedAssertion() {
-    SyncChunkStack stack = new SyncChunkStack(0L);
-    try {
-      stack.offer(0);
-      fail("expected AssertionError");
-    } catch (AssertionError expected) {
-    }
-  }
-
-
-  @Test
-  public void stackWithChunkClearReturnsAddressAndEmptiesStack() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-
-      long addr = chunk.getAddress();
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(addr);
-      long clearAddr = stack.clear();
-      assertEquals(addr, clearAddr);
-      assertEquals(true, stack.isEmpty());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-  @Test
-  public void stackWithChunkPollReturnsAddressAndEmptiesStack() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-
-      long addr = chunk.getAddress();
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(addr);
-      long pollAddr = stack.poll();
-      assertEquals(addr, pollAddr);
-      assertEquals(true, stack.isEmpty());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-  @Test
-  public void stackWithChunkTotalSizeIsChunkSize() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-      int chunkSize = chunk.getSize();
-
-      long addr = chunk.getAddress();
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(addr);
-      assertEquals(chunkSize, stack.computeTotalSize());
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-
-  @Test
-  public void stackWithChunkLogShowsMsgAndSize() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-      int chunkSize = chunk.getSize();
-
-      long addr = chunk.getAddress();
-      SyncChunkStack stack = new SyncChunkStack();
-      stack.offer(addr);
-      LogWriter lw = mock(LogWriter.class);
-      stack.logSizes(lw, "foo");
-      verify(lw).info("foo"+chunkSize);
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-  
-  private class TestableSyncChunkStack extends SyncChunkStack {
-    public boolean doConcurrentMod = true;
-    public int chunk2Size;
-    private SimpleMemoryAllocatorImpl ma;
-    TestableSyncChunkStack(SimpleMemoryAllocatorImpl ma) {
-      this.ma = ma;
-    }
-    @Override
-    protected void testHookDoConcurrentModification() {
-      if (doConcurrentMod) {
-        doConcurrentMod = false;
-        OffHeapStoredObject chunk2 = (OffHeapStoredObject) ma.allocate(50);
-        this.chunk2Size = chunk2.getSize();
-        this.offer(chunk2.getAddress());
-      }
-    }
-  }
-  @Test
-  public void stackWithChunkTotalSizeIsChunkSizeWithConcurrentMod() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-      int chunkSize = chunk.getSize();
-
-      long addr = chunk.getAddress();
-      TestableSyncChunkStack stack = new TestableSyncChunkStack(ma);
-      stack.offer(addr);
-      long totalSize = stack.computeTotalSize();
-      assertEquals("chunkSize=" + chunkSize + " chunk2Size=" + stack.chunk2Size, chunkSize + stack.chunk2Size, totalSize);
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-
-
-  @Test
-  public void stackWithChunkLogShowsMsgAndSizeWithConcurrentMod() {
-    SlabImpl slab = new SlabImpl(1024);
-    try {
-      SimpleMemoryAllocatorImpl ma = SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{slab});
-      OffHeapStoredObject chunk = (OffHeapStoredObject) ma.allocate(100);
-      int chunkSize = chunk.getSize();
-
-      long addr = chunk.getAddress();
-      TestableSyncChunkStack stack = new TestableSyncChunkStack(ma);
-      stack.offer(addr);
-      LogWriter lw = mock(LogWriter.class);
-      stack.logSizes(lw, "foo");
-      verify(lw).info("foo"+chunkSize);
-      verify(lw).info("foo"+stack.chunk2Size);
-    } finally {
-      SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-    }
-  }
-}