stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/4] stratos git commit: fixing to create VMClusterContext only once
Date Fri, 12 Dec 2014 04:51:01 GMT
Repository: stratos
Updated Branches:
  refs/heads/4.1.0-test 4862a8b76 -> 006129129


fixing to create VMClusterContext only once


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

Branch: refs/heads/4.1.0-test
Commit: 00612912923bb5ff9bce754c35a414f0a4bcd96c
Parents: 0183827
Author: reka <rthirunavukkarasu23@gmail.com>
Authored: Fri Dec 12 10:20:38 2014 +0530
Committer: reka <rthirunavukkarasu23@gmail.com>
Committed: Fri Dec 12 10:20:47 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/monitor/cluster/VMClusterMonitor.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/00612912/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
index ccd5e03..361148e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMClusterMonitor.java
@@ -1132,10 +1132,13 @@ public class VMClusterMonitor extends AbstractClusterMonitor {
             ClusterInstance clusterInstance = cluster.getInstanceContexts(parentInstanceId);
             if (clusterInstance != null) {
                 // Cluster instance is already there. No need to create one.
-                VMClusterContext clusterContext;
-                clusterContext =
-                        ClusterContextFactory.getVMClusterContext(clusterInstance.getInstanceId(),
cluster);
-                this.setClusterContext(clusterContext);
+                VMClusterContext clusterContext = (VMClusterContext) this.getClusterContext();
+                if(clusterContext == null) {
+                    clusterContext =
+                            ClusterContextFactory.getVMClusterContext(clusterInstance.getInstanceId(),
cluster);
+                    this.setClusterContext(clusterContext);
+                }
+
                 // create VMClusterContext and then add all the instanceContexts
                 clusterContext.addInstanceContext(parentInstanceId, cluster);
                 if (this.getInstance(clusterInstance.getInstanceId()) == null) {


Mime
View raw message