Repository: incubator-geode Updated Branches: refs/heads/feature/GEODE-409 1e6cc66d4 -> a73dc1b7d
[fixes GEODE-414] Add a retry so that PRMetaData will be updated with correct data. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a73dc1b7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a73dc1b7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a73dc1b7 Branch: refs/heads/feature/GEODE-409 Commit: a73dc1b7dc1b17429e73c7e97b5dceff203eed82 Parents: 1e6cc66 Author: eshu <[email protected]> Authored: Thu Oct 22 17:08:47 2015 -0700 Committer: eshu <[email protected]> Committed: Thu Oct 22 17:08:47 2015 -0700 ---------------------------------------------------------------------- .../PartitionedRegionSingleHopDUnitTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a73dc1b7/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java index 278c477..0e2ec72 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java @@ -830,6 +830,25 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase { assertTrue(regionMetaData.containsKey(region.getFullPath())); final ClientPartitionAdvisor prMetaData = regionMetaData.get(region.getFullPath()); + + //Fixes a race condition in GEODE-414 by retrying as + //region.clientMetaDataLock.tryLock() may prevent fetching the + //metadata through functional calls as only limited functions are executed in the test. + long start = System.currentTimeMillis(); + do { + if ((prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() !=4)) { + //waiting if there is another thread holding the lock + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + //ignored. + } + cms.getClientPRMetadata((LocalRegion)region); + } else { + break; + } + } while (System.currentTimeMillis() - start < 60000); + wc = new WaitCriterion() { public boolean done() { return (prMetaData.getBucketServerLocationsMap_TEST_ONLY().size() == 4);
