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 56AEE200BC0 for ; Tue, 15 Nov 2016 20:13:56 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 50A26160B26; Tue, 15 Nov 2016 19:13:56 +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 A8A89160B19 for ; Tue, 15 Nov 2016 20:13:55 +0100 (CET) Received: (qmail 68879 invoked by uid 500); 15 Nov 2016 19:13:54 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 68660 invoked by uid 99); 15 Nov 2016 19:13:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2016 19:13:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 79AABEFE5E; Tue, 15 Nov 2016 19:13:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: avijayan@apache.org To: commits@ambari.apache.org Date: Tue, 15 Nov 2016 19:14:00 -0000 Message-Id: <9ba816314d80438b83f92bf1ae03d85e@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/28] ambari git commit: AMBARI-18265. Make sure AMS embedded works after AMS HA changes. (avijayan) archived-at: Tue, 15 Nov 2016 19:13:56 -0000 AMBARI-18265. Make sure AMS embedded works after AMS HA changes. (avijayan) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b86690d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b86690d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b86690d Branch: refs/heads/branch-2.5 Commit: 2b86690da4646dcf804a90fe5f02728e723e1890 Parents: a7f9090 Author: Aravindan Vijayan Authored: Mon Nov 14 20:44:32 2016 -0800 Committer: Aravindan Vijayan Committed: Tue Nov 15 11:02:13 2016 -0800 ---------------------------------------------------------------------- .../timeline/HBaseTimelineMetricStore.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2b86690d/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java index 034fb2f..75ce845 100644 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java +++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/HBaseTimelineMetricStore.java @@ -387,15 +387,21 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin @Override public List getLiveInstances() { - List instances = haController.getLiveInstanceHostNames(); - if (instances == null || instances.isEmpty()) { - try { - // Always return current host as live (embedded operation mode) - instances = Collections.singletonList(configuration.getInstanceHostnameFromEnv()); + + List instances = null; + try { + if (haController == null) { + // Always return current host as live (embedded operation mode) + return Collections.singletonList(configuration.getInstanceHostnameFromEnv()); + } + instances = haController.getLiveInstanceHostNames(); + if (instances == null || instances.isEmpty()) { + // fallback + instances = Collections.singletonList(configuration.getInstanceHostnameFromEnv()); + } } catch (UnknownHostException e) { LOG.debug("Exception on getting hostname from env.", e); } - } return instances; }