You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2017/11/14 16:18:04 UTC
[geode] branch develop updated: GEODE-3973: have the cluster
configuration start synchronously when starting a locator (#1050)
This is an automated email from the ASF dual-hosted git repository.
jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new ae03b84 GEODE-3973: have the cluster configuration start synchronously when starting a locator (#1050)
ae03b84 is described below
commit ae03b844fdb0c38296a4ae535a3842185d08c37a
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Tue Nov 14 08:18:01 2017 -0800
GEODE-3973: have the cluster configuration start synchronously when starting a locator (#1050)
---
.../distributed/internal/InternalLocator.java | 80 ++++++++++------------
1 file changed, 35 insertions(+), 45 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index 942bbf2..73b971e 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -602,31 +602,6 @@ public class InternalLocator extends Locator implements ConnectListener {
s);
}
- class SharedConfigurationRunnable implements Runnable {
-
- private final InternalLocator locator = InternalLocator.this;
-
- @Override
- public void run() {
- try {
- if (this.locator.sharedConfig == null) {
- // locator.sharedConfig will already be created in case of auto-reconnect
- this.locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
- }
- this.locator.sharedConfig.initSharedConfiguration(this.locator.loadFromSharedConfigDir());
- this.locator.installSharedConfigDistribution();
- logger.info(
- "Cluster configuration service start up completed successfully and is now running ....");
- } catch (CancelException | LockServiceDestroyedException e) {
- if (logger.isDebugEnabled()) {
- logger.debug("Cluster configuration start up was cancelled", e);
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
-
/**
* Start a distributed system whose life cycle is managed by this locator. When the locator is
* stopped, this distributed system will be disconnected. If a distributed system already exists,
@@ -722,7 +697,7 @@ public class InternalLocator extends Locator implements ConnectListener {
}
startJmxManagerLocationService(internalCache);
- startSharedConfigurationService(internalCache);
+ startSharedConfigurationService();
}
/**
@@ -1089,19 +1064,13 @@ public class InternalLocator extends Locator implements ConnectListener {
this.myCache = newCache;
this.myDs.setDependentLocator(this);
logger.info("Locator restart: initializing TcpServer");
- if (isSharedConfigurationEnabled()) {
- this.sharedConfig = new ClusterConfigurationService(newCache);
- }
+
this.server.restarting(newSystem, newCache, this.sharedConfig);
if (this.productUseLog.isClosed()) {
this.productUseLog.reopen();
}
this.productUseLog.monitorUse(newSystem);
- this.isSharedConfigurationStarted = true;
- if (isSharedConfigurationEnabled()) {
- ExecutorService es = newCache.getDistributionManager().getThreadPool();
- es.execute(new SharedConfigurationRunnable());
- }
+ startSharedConfigurationService();
if (!this.server.isAlive()) {
logger.info("Locator restart: starting TcpServer");
startTcpServer();
@@ -1378,20 +1347,41 @@ public class InternalLocator extends Locator implements ConnectListener {
}
}
- private void startSharedConfigurationService(InternalCache internalCache) {
+ private void startSharedConfigurationService() {
installSharedConfigHandler();
- if (this.config.getEnableClusterConfiguration() && !this.isSharedConfigurationStarted) {
- if (!isDedicatedLocator()) {
- logger.info("Cluster configuration service not enabled as it is only supported "
- + "in dedicated locators");
- return;
- }
-
- ExecutorService es = internalCache.getDistributionManager().getThreadPool();
- es.execute(new SharedConfigurationRunnable());
- } else {
+ if (!config.getEnableClusterConfiguration()) {
logger.info("Cluster configuration service is disabled");
+ return;
+ }
+
+ if (isSharedConfigurationStarted) {
+ logger.info("Cluster configuration service is already started.");
+ return;
+ }
+
+ if (!isDedicatedLocator()) {
+ logger.info("Cluster configuration service not enabled as it is only supported "
+ + "in dedicated locators");
+ return;
+ }
+
+ try {
+ if (this.locator.sharedConfig == null) {
+ // locator.sharedConfig will already be created in case of auto-reconnect
+ this.locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
+ }
+ this.locator.sharedConfig.initSharedConfiguration(this.locator.loadFromSharedConfigDir());
+ this.locator.installSharedConfigDistribution();
+ logger.info(
+ "Cluster configuration service start up completed successfully and is now running ....");
+ isSharedConfigurationStarted = true;
+ } catch (CancelException | LockServiceDestroyedException e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cluster configuration start up was cancelled", e);
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
}
}
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].