Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 371B6200D48 for ; Tue, 14 Nov 2017 17:18:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 35C2F160BF4; Tue, 14 Nov 2017 16:18:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E5341609EF for ; Tue, 14 Nov 2017 17:18:06 +0100 (CET) Received: (qmail 46173 invoked by uid 500); 14 Nov 2017 16:18:05 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 46131 invoked by uid 99); 14 Nov 2017 16:18:05 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Nov 2017 16:18:05 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id C60A481197; Tue, 14 Nov 2017 16:18:04 +0000 (UTC) Date: Tue, 14 Nov 2017 16:18:04 +0000 To: "commits@geode.apache.org" Subject: [geode] branch develop updated: GEODE-3973: have the cluster configuration start synchronously when starting a locator (#1050) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <151067628461.16119.15079737262900325192@gitbox.apache.org> From: jinmeiliao@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: geode X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Oldrev: 141c793f95ac799c64148c1ba98b00e6bd14e611 X-Git-Newrev: ae03b844fdb0c38296a4ae535a3842185d08c37a X-Git-Rev: ae03b844fdb0c38296a4ae535a3842185d08c37a X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Tue, 14 Nov 2017 16:18:07 -0000 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 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" '].