incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1179821 - in /incubator/ambari/trunk/controller/src/main/java/org/apache/ambari: controller/HeartbeatHandler.java resource/statemachine/StateMachineInvoker.java
Date Thu, 06 Oct 2011 20:23:00 GMT
Author: ddas
Date: Thu Oct  6 20:22:59 2011
New Revision: 1179821

URL: http://svn.apache.org/viewvc?rev=1179821&view=rev
Log:
AMBARI-43. Fixes a build problem, and adds another API to get the clusterstate based on blueprint.
Contributed by Devaraj Das.

Modified:
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/HeartbeatHandler.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/resource/statemachine/StateMachineInvoker.java

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/HeartbeatHandler.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/HeartbeatHandler.java?rev=1179821&r1=1179820&r2=1179821&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/HeartbeatHandler.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/HeartbeatHandler.java
Thu Oct  6 20:22:59 2011
@@ -80,7 +80,7 @@ public class HeartbeatHandler {
         DatatypeFactory.newInstance().newXMLGregorianCalendar(c));
     
     Cluster cluster = 
-        Clusters.getInstance().getClusterByName(state.getClusterName());
+        Clusters.getInstance().getClusterByID(state.getClusterName());
     ClusterContext clusterContext = new ClusterContextImpl(cluster, node);
     
     List<Action> allActions = new ArrayList<Action>();
@@ -106,7 +106,9 @@ public class HeartbeatHandler {
 
       //get the state machine reference to the cluster
       ClusterFSM clusterSMobject = StateMachineInvoker
-          .getStateMachineClusterInstance(state.getClusterName());
+          .getStateMachineClusterInstance(cluster.getID(), 
+              cluster.getClusterDefinition().getBlueprintName(), 
+              cluster.getClusterDefinition().getBlueprintRevision());
       //the state machine reference to the services
       List<ServiceFSM> clusterServices = clusterSMobject.getServices();
       //go through all the services, and check which role should be started

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/resource/statemachine/StateMachineInvoker.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/resource/statemachine/StateMachineInvoker.java?rev=1179821&r1=1179820&r2=1179821&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/resource/statemachine/StateMachineInvoker.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/resource/statemachine/StateMachineInvoker.java
Thu Oct  6 20:22:59 2011
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.ConcurrentMap;
 
 import org.apache.ambari.common.rest.entities.Cluster;
+import org.apache.ambari.common.rest.entities.ClusterState;
 import org.apache.ambari.event.AsyncDispatcher;
 import org.apache.ambari.event.Dispatcher;
 import org.apache.ambari.event.EventHandler;
@@ -88,5 +89,11 @@ public class StateMachineInvoker {
   public static ClusterFSM getStateMachineClusterInstance(String clusterId,
       String blueprintName, String blueprintRev) {
     return clusters.get(getClusterKey(clusterId, blueprintName, blueprintRev));
-  }    
+  }
+  
+  public static ClusterState getClusterState(String clusterId,
+      String blueprintName, String blueprintRev) {
+    return clusters.get(getClusterKey(clusterId, blueprintName, blueprintRev))
+                     .getClusterState();
+  }
 }



Mime
View raw message