You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dd...@apache.org on 2011/10/12 03:00:45 UTC
svn commit: r1182157 - in
/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari:
controller/Clusters.java controller/HeartbeatHandler.java
resource/statemachine/StateMachineInvoker.java
Author: ddas
Date: Wed Oct 12 01:00:44 2011
New Revision: 1182157
URL: http://svn.apache.org/viewvc?rev=1182157&view=rev
Log:
AMBARI-59. Fixes the API getStateMachineClusterInstance to not take cluster-revision argument
Modified:
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
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/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java?rev=1182157&r1=1182156&r2=1182157&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java Wed Oct 12 01:00:44 2011
@@ -578,8 +578,7 @@ public class Clusters {
* TODO: Persist the latest cluster definition under new revision
*/
ClusterFSM clusterFSM = StateMachineInvoker.
- getStateMachineClusterInstance(cls.getID(),
- cls.getLatestRevision());
+ getStateMachineClusterInstance(cls.getID());
if(c.getGoalState().equals(ClusterState.CLUSTER_STATE_ACTIVE)) {
clusterFSM.activate();
} else if(c.getGoalState().
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=1182157&r1=1182156&r2=1182157&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 Wed Oct 12 01:00:44 2011
@@ -97,8 +97,6 @@ public class HeartbeatHandler {
//command more than once. In the future this could be improved
//to reflect the command execution state more accurately.
- long desiredClusterDefinitionRev =
- cluster.getLatestRevision();
String desiredClusterId = cluster.getID();
StartedComponentServers componentServers = new StartedComponentServers();
@@ -111,8 +109,7 @@ public class HeartbeatHandler {
//get the state machine reference to the cluster
ClusterFSM clusterSMobject = StateMachineInvoker
- .getStateMachineClusterInstance(desiredClusterId,
- desiredClusterDefinitionRev);
+ .getStateMachineClusterInstance(desiredClusterId);
//the state machine reference to the services
List<ServiceFSM> clusterServices = clusterSMobject.getServices();
//go through all the services, and check which role should be started
@@ -280,8 +277,7 @@ public class HeartbeatHandler {
boolean uninstall = false;
ClusterFSM clusterFSM = StateMachineInvoker
- .getStateMachineClusterInstance(agentRoleState.getClusterId(),
- agentRoleState.getClusterDefinitionRevision());
+ .getStateMachineClusterInstance(agentRoleState.getClusterId());
if (clusterFSM == null) {
//ask the agent to stop everything belonging to this role
//since the controller can't be in a state where the clusterFSM
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=1182157&r1=1182156&r2=1182157&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 Wed Oct 12 01:00:44 2011
@@ -73,26 +73,18 @@ public class StateMachineInvoker {
private static ConcurrentMap<String, ClusterFSM> clusters =
new ConcurrentHashMap<String, ClusterFSM>();
- private static String getClusterKey(String clusterId,
- long clusterDefinitionRev) {
- return clusterId + clusterDefinitionRev;
- }
-
public static ClusterFSM createCluster(Cluster cluster) throws IOException {
ClusterImpl clusterFSM = new ClusterImpl(cluster);
- clusters.put(getClusterKey(cluster.getID(),
- cluster.getLatestRevision()), clusterFSM);
+ clusters.put(cluster.getID(), clusterFSM);
return clusterFSM;
}
- public static ClusterFSM getStateMachineClusterInstance(String clusterId,
- long clusterDefinitionRev) {
- return clusters.get(getClusterKey(clusterId, clusterDefinitionRev));
+ public static ClusterFSM getStateMachineClusterInstance(String clusterId) {
+ return clusters.get(clusterId);
}
public static ClusterState getClusterState(String clusterId,
long clusterDefinitionRev) {
- return clusters.get(getClusterKey(clusterId, clusterDefinitionRev))
- .getClusterState();
+ return clusters.get(clusterId).getClusterState();
}
}