ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject [07/28] ambari git commit: AMBARI-18265. Make sure AMS embedded works after AMS HA changes. (avijayan)
Date Tue, 15 Nov 2016 19:14:00 GMT
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 <avijayan@hortonworks.com>
Authored: Mon Nov 14 20:44:32 2016 -0800
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
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<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;
   }
 


Mime
View raw message