You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/05/19 16:30:38 UTC

stratos git commit: propergating autoscaling policy update to existing clusters

Repository: stratos
Updated Branches:
  refs/heads/master 9062fc83f -> becc7a911


propergating autoscaling policy update to existing clusters


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/becc7a91
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/becc7a91
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/becc7a91

Branch: refs/heads/master
Commit: becc7a91198860285b0e90bd3b10860552f487b3
Parents: 9062fc8
Author: reka <rt...@gmail.com>
Authored: Tue May 19 20:00:08 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Tue May 19 20:00:27 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/context/cluster/ClusterContext.java      | 12 ++++--------
 .../context/cluster/ClusterContextFactory.java          |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/becc7a91/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
index 100ae23..edf37c7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContext.java
@@ -58,16 +58,16 @@ public class ClusterContext extends AbstractClusterContext {
     // Map<NetworkpartitionId, Network Partition Context>
     protected Map<String, ClusterLevelNetworkPartitionContext> networkPartitionCtxts;
 
-    protected AutoscalePolicy autoscalePolicy;
+    private String autoscalingPolicyId;
 
     private String deploymentPolicyId;
 
-    public ClusterContext(String clusterId, String serviceId, AutoscalePolicy autoscalePolicy,
+    public ClusterContext(String clusterId, String serviceId, String autoscalingPolicyId,
                           boolean hasScalingDependents, String deploymentPolicyId) {
 
         super(clusterId, serviceId);
         this.networkPartitionCtxts = new ConcurrentHashMap<String, ClusterLevelNetworkPartitionContext>();
-        this.autoscalePolicy = autoscalePolicy;
+        this.autoscalingPolicyId = autoscalingPolicyId;
         this.deploymentPolicyId = deploymentPolicyId;
     }
 
@@ -76,11 +76,7 @@ public class ClusterContext extends AbstractClusterContext {
     }
 
     public AutoscalePolicy getAutoscalePolicy() {
-        return autoscalePolicy;
-    }
-
-    public void setAutoscalePolicy(AutoscalePolicy autoscalePolicy) {
-        this.autoscalePolicy = autoscalePolicy;
+        return PolicyManager.getInstance().getAutoscalePolicy(autoscalingPolicyId);
     }
 
     public ClusterLevelNetworkPartitionContext getNetworkPartitionCtxt(String networkPartitionId) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/becc7a91/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java
index 6195ca5..a8fa9ad 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterContextFactory.java
@@ -40,13 +40,13 @@ public class ClusterContextFactory {
         }
 
         String autoscalePolicyName = cluster.getAutoscalePolicyName();
-        AutoscalePolicy autoscalePolicy = PolicyManager.getInstance().getAutoscalePolicy(autoscalePolicyName);
 
         if (log.isDebugEnabled()) {
             log.debug("Autoscaler policy name: " + autoscalePolicyName);
         }
 
-        return new ClusterContext(cluster.getClusterId(), cluster.getServiceName(), autoscalePolicy, hasScalingDependents,
+        return new ClusterContext(cluster.getClusterId(), cluster.getServiceName(),
+                autoscalePolicyName, hasScalingDependents,
                 deploymentPolicyId);
     }
 }