GEODE-220: Use wait after off-heap destroyRegion

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

Branch: refs/heads/develop
Commit: 96e889ee9fea560d92b33b1b0336369a42032847
Parents: 57c5247
Author: Darrel Schneider <dschnei...@pivotal.io>
Authored: Fri Aug 14 14:15:35 2015 -0700
Committer: Kirk Lund <kl...@pivotal.io>
Committed: Wed Aug 19 16:08:05 2015 -0700

----------------------------------------------------------------------
 .../gemstone/gemfire/cache30/MultiVMRegionTestCase.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/96e889ee/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index ecec932..c5e2821 100644
--- 
a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ 
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -2323,8 +2323,16 @@ public abstract class MultiVMRegionTestCase extends 
RegionTestCase {
           region.destroyRegion(arg);
           if (region.getAttributes().getOffHeap() && !(region instanceof 
PartitionedRegion)) {
             GemFireCacheImpl gfc = (GemFireCacheImpl) getCache();
-            SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) 
gfc.getOffHeapStore();
-            assertEquals(0, ma.getStats().getObjects());
+            final SimpleMemoryAllocatorImpl ma = (SimpleMemoryAllocatorImpl) 
gfc.getOffHeapStore();
+            WaitCriterion waitForStatChange = new WaitCriterion() {
+              public boolean done() {
+                return ma.getStats().getObjects() == 0;
+              }
+              public String description() {
+                return "never saw off-heap object count go to zero. Last value 
was " + ma.getStats().getObjects();
+              }
+            };
+            DistributedTestCase.waitForCriterion(waitForStatChange, 3000, 10, 
true);
           }
         }
       });

Reply via email to