فهرست منبع

AMBARI-3718. Optimize stale config lookup for Hsot Component API call. Minor tweaks. (swagle)

Siddharth Wagle 11 سال پیش
والد
کامیت
d23cdc160a

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java

@@ -93,7 +93,7 @@ public class HeartBeatHandler {
     this.clusterFsm = fsm;
     this.actionQueue = aq;
     this.actionManager = am;
-    this.heartbeatMonitor = new HeartbeatMonitor(fsm, aq, am, 60000, ambariMetaInfo);
+    this.heartbeatMonitor = new HeartbeatMonitor(fsm, aq, am, 60000, injector);
     injector.injectMembers(this);
   }
 

+ 3 - 2
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java

@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
+import com.google.inject.Injector;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
@@ -55,12 +56,12 @@ public class HeartbeatMonitor implements Runnable {
   private final ConfigHelper configHelper;
 
   public HeartbeatMonitor(Clusters clusters, ActionQueue aq, ActionManager am,
-                          int threadWakeupInterval, AmbariMetaInfo ambariMetaInfo) {
+                          int threadWakeupInterval, Injector injector) {
     this.clusters = clusters;
     this.actionQueue = aq;
     this.actionManager = am;
     this.threadWakeupInterval = threadWakeupInterval;
-    this.configHelper = new ConfigHelper(this.clusters, ambariMetaInfo);
+    this.configHelper = injector.getInstance(ConfigHelper.class);
   }
 
   public void shutdown() {

+ 5 - 5
ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java

@@ -130,7 +130,7 @@ public class TestHeartbeatMonitor {
     ActionQueue aq = new ActionQueue();
     ActionManager am = mock(ActionManager.class);
     HeartbeatMonitor hm = new HeartbeatMonitor(clusters, aq, am,
-      heartbeatMonitorWakeupIntervalMS, ambariMetaInfo);
+      heartbeatMonitorWakeupIntervalMS, injector);
     HeartBeatHandler handler = new HeartBeatHandler(clusters, aq, am, injector);
     Register reg = new Register();
     reg.setHostname(hostname1);
@@ -217,7 +217,7 @@ public class TestHeartbeatMonitor {
     ActionQueue aq = new ActionQueue();
     ActionManager am = mock(ActionManager.class);
     HeartbeatMonitor hm = new HeartbeatMonitor(clusters, aq, am,
-      heartbeatMonitorWakeupIntervalMS, ambariMetaInfo);
+      heartbeatMonitorWakeupIntervalMS, injector);
     HeartBeatHandler handler = new HeartBeatHandler(clusters, aq, am, injector);
     Register reg = new Register();
     reg.setHostname(hostname1);
@@ -298,7 +298,7 @@ public class TestHeartbeatMonitor {
 
     ActionManager am = mock(ActionManager.class);
     HeartbeatMonitor hm = new HeartbeatMonitor(clusters, aqMock, am,
-      heartbeatMonitorWakeupIntervalMS, ambariMetaInfo);
+      heartbeatMonitorWakeupIntervalMS, injector);
     HeartBeatHandler handler = new HeartBeatHandler(clusters, aqMock, am,
         injector);
     Register reg = new Register();
@@ -343,7 +343,7 @@ public class TestHeartbeatMonitor {
     fsm.addHost(hostname);
     ActionQueue aq = new ActionQueue();
     ActionManager am = mock(ActionManager.class);
-    HeartbeatMonitor hm = new HeartbeatMonitor(fsm, aq, am, 10, ambariMetaInfo);
+    HeartbeatMonitor hm = new HeartbeatMonitor(fsm, aq, am, 10, injector);
     HeartBeatHandler handler = new HeartBeatHandler(fsm, aq, am, injector);
     Register reg = new Register();
     reg.setHostname(hostname);
@@ -400,7 +400,7 @@ public class TestHeartbeatMonitor {
     
     ActionQueue aq = new ActionQueue();
     ActionManager am = mock(ActionManager.class);
-    HeartbeatMonitor hm = new HeartbeatMonitor(clusters, aq, am, 10, ambariMetaInfo);
+    HeartbeatMonitor hm = new HeartbeatMonitor(clusters, aq, am, 10, injector);
     HeartBeatHandler handler = new HeartBeatHandler(clusters, aq, am, injector);
     
     Register reg = new Register();