Repository: incubator-geode Updated Branches: refs/heads/develop 0c8b2b3b8 -> 331cf2842
GEODE-900 Test was using stale cache. While creating gemfire cache, it validates cache config with existing cache. And if those are same it returns existing cache. But in this case existing cache was close. Now we create new cache if existing cache is close. Now we synchronized whole cache creation. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/ef0c6828 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/ef0c6828 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/ef0c6828 Branch: refs/heads/develop Commit: ef0c682803d17dc8d025c168652bbd1e63c3c10d Parents: 0c8b2b3 Author: Hitesh Khamesra <[email protected]> Authored: Wed Aug 31 11:17:31 2016 -0700 Committer: Hitesh Khamesra <[email protected]> Committed: Wed Aug 31 11:17:31 2016 -0700 ---------------------------------------------------------------------- .../gemfire/internal/cache/GemFireCacheImpl.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ef0c6828/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java index 76a7bad..47c7e24 100755 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java @@ -757,12 +757,14 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer RegionExistsException { try { - GemFireCacheImpl instance = checkExistingCache(existingOk, cacheConfig); - if (instance == null) { - instance = new GemFireCacheImpl(isClient, pf, system, cacheConfig, asyncEventListeners, typeRegistry); - instance.initialize(); + synchronized (GemFireCacheImpl.class) { + GemFireCacheImpl instance = checkExistingCache(existingOk, cacheConfig); + if (instance == null) { + instance = new GemFireCacheImpl(isClient, pf, system, cacheConfig, asyncEventListeners, typeRegistry); + instance.initialize(); + } + return instance; } - return instance; } catch (CacheXmlException | IllegalArgumentException e) { logger.error(e.getLocalizedMessage()); throw e; @@ -779,13 +781,13 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer if (existingOk) { // Check if cache configuration matches. cacheConfig.validateCacheConfig(instance); - + return instance; } else { // instance.creationStack argument is for debugging... throw new CacheExistsException(instance, LocalizedStrings.CacheFactory_0_AN_OPEN_CACHE_ALREADY_EXISTS.toLocalizedString(instance), instance.creationStack); } } - return instance; + return null; } /**
