Repository: incubator-geode Updated Branches: refs/heads/feature/GEM-983 35441b8aa -> 7f920879a
changed to an AtomicBoolean, remove cache sync on addPartitionedRegion and requiresNotificationFromPR Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7f920879 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7f920879 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7f920879 Branch: refs/heads/feature/GEM-983 Commit: 7f920879a7b75f8ffc624eadd34fe63dff27ffb8 Parents: 35441b8 Author: Darrel Schneider <[email protected]> Authored: Tue Oct 11 15:47:45 2016 -0700 Committer: Darrel Schneider <[email protected]> Committed: Tue Oct 11 15:47:45 2016 -0700 ---------------------------------------------------------------------- .../geode/internal/cache/GemFireCacheImpl.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7f920879/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java index de23cc3..9da3e79 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java @@ -523,7 +523,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer private final Object clientMetaDatServiceLock = new Object(); - private volatile boolean isShutDownAll = false; + private final AtomicBoolean isShutDownAll = new AtomicBoolean(false); private final ResourceAdvisor resourceAdvisor; private final JmxManagerAdvisor jmxAdvisor; @@ -642,7 +642,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer sb.append("GemFireCache["); sb.append("id = " + System.identityHashCode(this)); sb.append("; isClosing = " + this.isClosing); - sb.append("; isShutDownAll = " + this.isShutDownAll); + sb.append("; isShutDownAll = " + isCacheAtShutdownAll()); sb.append("; created = " + this.creationDate); sb.append("; server = " + this.isServer); sb.append("; copyOnRead = " + this.copyOnRead); @@ -1641,7 +1641,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer } public boolean isCacheAtShutdownAll() { - return isShutDownAll; + return isShutDownAll.get(); } /** @@ -1656,8 +1656,6 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer } public void shutDownAll() { - synchronized(GemFireCacheImpl.class) { - synchronized(this) { boolean testIGE = Boolean.getBoolean("TestInternalGemFireError"); if (testIGE) { @@ -1675,8 +1673,13 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false; } } - this.isShutDownAll = true; + if (!this.isShutDownAll.compareAndSet(false, true)) { + // it's already doing shutdown by another thread + return; + } + synchronized(GemFireCacheImpl.class) { + synchronized(this) { // bug 44031 requires multithread shutdownall should be grouped // by root region. However, shutDownAllDuringRecovery.conf test revealed that // we have to close colocated child regions first. @@ -4058,7 +4061,6 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer * cache requires, or does not require notification of all region/entry events. */ public void addPartitionedRegion(PartitionedRegion r) { - synchronized (GemFireCacheImpl.class) { synchronized (this.partitionedRegions) { if (r.isDestroyed()) { if (logger.isDebugEnabled()) { @@ -4070,7 +4072,6 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer getCachePerfStats().incPartitionedRegions(1); } } - } } /** @@ -4163,7 +4164,6 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer * @return true if the region should deliver all of its events to this cache */ protected boolean requiresNotificationFromPR(PartitionedRegion r) { - synchronized (GemFireCacheImpl.class) { boolean hasSerialSenders = hasSerialSenders(r); boolean result = hasSerialSenders; if (!result) { @@ -4178,7 +4178,6 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer } return result; - } } private boolean hasSerialSenders(PartitionedRegion r) {
