Repository: incubator-geode Updated Branches: refs/heads/feature/GEODE-409 e45f5e3aa -> 5a7b28d03
GEODE-410: fix race in testEntryTtlLocalDestroy Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5a7b28d0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5a7b28d0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5a7b28d0 Branch: refs/heads/feature/GEODE-409 Commit: 5a7b28d031f4461c52c1f801ff6ed03a1ed8907f Parents: e45f5e3 Author: Darrel Schneider <[email protected]> Authored: Mon Oct 19 10:42:22 2015 -0700 Committer: Darrel Schneider <[email protected]> Committed: Mon Oct 19 10:42:22 2015 -0700 ---------------------------------------------------------------------- .../gemfire/cache30/MultiVMRegionTestCase.java | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5a7b28d0/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 c5e2821..b6ba865 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 @@ -4059,13 +4059,13 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { vm0.invoke(new CacheSerializableRunnable("Check local destroy") { public void run2() throws CacheException { - Region region = + final Region region = getRootRegion().getSubregion(name); // make sure we created the entry { CountingDistCacheListener l = (CountingDistCacheListener) region.getAttributes().getCacheListeners()[0]; - int retry = 100; + int retry = 1000; while (retry-- > 0) { try { l.assertCount(1, 0, 0, 0); @@ -4081,11 +4081,19 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { } { // now make sure it expires - // this should happen really fast since timeout is 10 ms - int retry = 10; - while (retry-- > 0 && region.getEntry(key) != null) { - pause(timeout); - } + // this should happen really fast since timeout is 10 ms. + // But it may take longer in some cases because of thread + // scheduling delays and machine load (see GEODE-410). + // The previous code would fail after 100ms; now we wait 3000ms. + WaitCriterion waitForUpdate = new WaitCriterion() { + public boolean done() { + return region.getEntry(key) == null; + } + public String description() { + return "Entry for key " + key + " never expired (since it still exists)"; + } + }; + DistributedTestCase.waitForCriterion(waitForUpdate, 3000, 1, true); } assertNull(region.getEntry(key)); }
