You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/10/12 18:39:15 UTC
incubator-geode git commit: fixed formatting. Removed class sync on
rmqFactory
Repository: incubator-geode
Updated Branches:
refs/heads/feature/GEM-983 7f920879a -> 8165e6047
fixed formatting. Removed class sync on rmqFactory
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/8165e604
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/8165e604
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/8165e604
Branch: refs/heads/feature/GEM-983
Commit: 8165e60471f99bd9d078f523cf54355891dd7d12
Parents: 7f92087
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Wed Oct 12 11:37:41 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Wed Oct 12 11:37:41 2016 -0700
----------------------------------------------------------------------
.../geode/internal/cache/GemFireCacheImpl.java | 121 ++++++++-----------
1 file changed, 52 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8165e604/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 9da3e79..0e23aaa 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
@@ -843,7 +843,7 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
this.cqService = CqServiceProvider.create(this);
- initReliableMessageQueueFactory();
+ this.rmqFactory = new ReliableMessageQueueFactoryImpl();
// Create the CacheStatistics
this.cachePerfStats = new CachePerfStats(system);
@@ -1678,40 +1678,38 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
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.
- // Now check all the PR, if anyone has colocate-with attribute, sort all the
- // PRs by colocation relationship and close them sequentially, otherwise still
- // group them by root region.
- TreeMap<String, Map<String, PartitionedRegion>> prTrees = getPRTrees();
- if (prTrees.size() > 1 && shutdownAllPoolSize != 1) {
- ExecutorService es = getShutdownAllExecutorService(prTrees.size());
- for (final Map<String, PartitionedRegion> prSubMap : prTrees.values()) {
- es.execute(new Runnable() {
- public void run() {
- ConnectionTable.threadWantsSharedResources();
- shutdownSubTreeGracefully(prSubMap);
- }
- });
- } // for each root
- es.shutdown();
- try {
- es.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- logger.debug("Shutdown all interrupted while waiting for PRs to be shutdown gracefully.");
- }
+ synchronized (GemFireCacheImpl.class) {
+ // 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.
+ // Now check all the PR, if anyone has colocate-with attribute, sort all the
+ // PRs by colocation relationship and close them sequentially, otherwise still
+ // group them by root region.
+ TreeMap<String, Map<String, PartitionedRegion>> prTrees = getPRTrees();
+ if (prTrees.size() > 1 && shutdownAllPoolSize != 1) {
+ ExecutorService es = getShutdownAllExecutorService(prTrees.size());
+ for (final Map<String, PartitionedRegion> prSubMap : prTrees.values()) {
+ es.execute(new Runnable() {
+ public void run() {
+ ConnectionTable.threadWantsSharedResources();
+ shutdownSubTreeGracefully(prSubMap);
+ }
+ });
+ } // for each root
+ es.shutdown();
+ try {
+ es.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ logger.debug("Shutdown all interrupted while waiting for PRs to be shutdown gracefully.");
+ }
- } else {
- for (final Map<String, PartitionedRegion> prSubMap : prTrees.values()) {
- shutdownSubTreeGracefully(prSubMap);
+ } else {
+ for (final Map<String, PartitionedRegion> prSubMap : prTrees.values()) {
+ shutdownSubTreeGracefully(prSubMap);
+ }
}
- }
- close("Shut down all members", null, false, true);
- }
+ close("Shut down all members", null, false, true);
}
}
@@ -4061,17 +4059,17 @@ 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 (this.partitionedRegions) {
- if (r.isDestroyed()) {
- if (logger.isDebugEnabled()) {
- logger.debug("GemFireCache#addPartitionedRegion did not add destroyed {}", r);
- }
- return;
- }
- if (this.partitionedRegions.add(r)) {
- getCachePerfStats().incPartitionedRegions(1);
+ synchronized (this.partitionedRegions) {
+ if (r.isDestroyed()) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("GemFireCache#addPartitionedRegion did not add destroyed {}", r);
}
+ return;
}
+ if (this.partitionedRegions.add(r)) {
+ getCachePerfStats().incPartitionedRegions(1);
+ }
+ }
}
/**
@@ -4164,20 +4162,20 @@ 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) {
- boolean hasSerialSenders = hasSerialSenders(r);
- boolean result = hasSerialSenders;
- if (!result) {
- Iterator allCacheServersIterator = allCacheServers.iterator();
- while (allCacheServersIterator.hasNext()) {
- CacheServerImpl server = (CacheServerImpl) allCacheServersIterator.next();
- if (!server.getNotifyBySubscription()) {
- result = true;
- break;
- }
+ boolean hasSerialSenders = hasSerialSenders(r);
+ boolean result = hasSerialSenders;
+ if (!result) {
+ Iterator allCacheServersIterator = allCacheServers.iterator();
+ while (allCacheServersIterator.hasNext()) {
+ CacheServerImpl server = (CacheServerImpl) allCacheServersIterator.next();
+ if (!server.getNotifyBySubscription()) {
+ result = true;
+ break;
}
-
}
- return result;
+
+ }
+ return result;
}
private boolean hasSerialSenders(PartitionedRegion r) {
@@ -4353,26 +4351,11 @@ public class GemFireCacheImpl implements InternalCache, ClientCache, HasCachePer
/**
* This cache's reliable message queue factory. Should always have an instance of it.
*/
- private ReliableMessageQueueFactory rmqFactory;
+ private final ReliableMessageQueueFactory rmqFactory;
private List<File> backupFiles = Collections.emptyList();
/**
- * Initializes the reliable message queue. Needs to be called at cache creation
- *
- * @throws IllegalStateException
- * if the factory is in use
- */
- private void initReliableMessageQueueFactory() {
- synchronized (GemFireCacheImpl.class) {
- if (this.rmqFactory != null) {
- this.rmqFactory.close(false);
- }
- this.rmqFactory = new ReliableMessageQueueFactoryImpl();
- }
- }
-
- /**
* Returns this cache's ReliableMessageQueueFactory.
*
* @since GemFire 5.0