You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2016/08/25 22:20:11 UTC

ambari git commit: AMBARI-18265 : Make sure AMS embedded works after AMS HA changes. (avijayan)

Repository: ambari
Updated Branches:
  refs/heads/trunk 5dbb43e7f -> 2cbbe3817


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/2cbbe381
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2cbbe381
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2cbbe381

Branch: refs/heads/trunk
Commit: 2cbbe3817a8abaca646397e7d834632add3dd3bc
Parents: 5dbb43e
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Aug 25 15:19:17 2016 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Aug 25 15:19:47 2016 -0700

----------------------------------------------------------------------
 .../timeline/HBaseTimelineMetricStore.java        | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2cbbe381/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 0f98db2..60ebdcf 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
@@ -385,15 +385,21 @@ public class HBaseTimelineMetricStore extends AbstractService implements Timelin
 
   @Override
   public List<String> getLiveInstances() {
-    List<String> instances = haController.getLiveInstanceHostNames();
-    if (instances == null || instances.isEmpty()) {
-      try {
-        // Always return current host as live (embedded operation mode)
-        instances = Collections.singletonList(configuration.getInstanceHostnameFromEnv());
+
+    List<String> 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;
   }