You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/12/07 13:40:42 UTC

[09/16] stratos git commit: Resolving conflicts

Resolving conflicts


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

Branch: refs/heads/master
Commit: 826bc65bd56f37e3a60c66767ee45b59f85cd9ca
Parents: 2b5cbd8
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sat Dec 6 18:17:29 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:00:49 2014 +0530

----------------------------------------------------------------------
 .../AutoscalerTopologyEventReceiver.java        | 65 ++++++++------------
 1 file changed, 27 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/826bc65b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
index 3cf6d81..fff3b73 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java
@@ -433,44 +433,33 @@ public class AutoscalerTopologyEventReceiver {
 
                        if (service != null) {
                            Cluster cluster = service.getCluster(clusterInstanceCreatedEvent.getClusterId());
-                           if (cluster != null) {
-                               try {
-                                   if (cluster.isKubernetesCluster()) {
-                                       clusterMonitor.setClusterContext(
-                                               ClusterContextFactory.getKubernetesClusterContext(
-                                                       instanceId,
-                                                       cluster));
-                                   } else {
-                                       VMClusterContext clusterContext =
-                                               (VMClusterContext) clusterMonitor.getClusterContext();
-                                       if (clusterContext == null) {
-                                           clusterContext = ClusterContextFactory.
-                                                   getVMClusterContext(instanceId,
-                                                           cluster);
-                                           clusterMonitor.setClusterContext(clusterContext);
-
-                                       }
-                                       clusterContext.addInstanceContext(instanceId, cluster);
-                                       if (clusterMonitor.getInstance(instanceId) == null) {
-                                           //adding the same instance in topology to monitor as a reference
-                                           ClusterInstance clusterInstance1 = cluster.
-                                                   getInstanceContexts(instanceId);
-                                           clusterMonitor.addInstance(clusterInstance1);
-                                       }
-
-
-                                   }
-                                   if (clusterMonitor.hasMonitoringStarted().compareAndSet(false, true)) {
-                                       clusterMonitor.startScheduler();
-                                       log.info("Monitoring task for Cluster Monitor with cluster id " +
-                                               clusterInstanceCreatedEvent.getClusterId() + " started successfully");
-                                   }
-                               } catch (PolicyValidationException e) {
-                                   log.error(e.getMessage(), e);
-                               } catch (PartitionValidationException e) {
-                                   log.error(e.getMessage(), e);
-                               }
-                           }
+                            if (cluster != null) {
+                                try {
+                                    VMClusterContext clusterContext =
+                                            (VMClusterContext) clusterMonitor.getClusterContext();
+                                    if (clusterContext == null) {
+                                        clusterContext = ClusterContextFactory.getVMClusterContext(instanceId, cluster);
+                                        clusterMonitor.setClusterContext(clusterContext);
+
+                                    }
+                                    clusterContext.addInstanceContext(instanceId, cluster);
+                                    if (clusterMonitor.getInstance(instanceId) == null) {
+                                        // adding the same instance in topology to monitor as a reference
+                                        ClusterInstance clusterInstance1 = cluster.getInstanceContexts(instanceId);
+                                        clusterMonitor.addInstance(clusterInstance1);
+                                    }
+
+                                    if (clusterMonitor.hasMonitoringStarted().compareAndSet(false, true)) {
+                                        clusterMonitor.startScheduler();
+                                        log.info("Monitoring task for Cluster Monitor with cluster id "
+                                                + clusterInstanceCreatedEvent.getClusterId() + " started successfully");
+                                    }
+                                } catch (PolicyValidationException e) {
+                                    log.error(e.getMessage(), e);
+                                } catch (PartitionValidationException e) {
+                                    log.error(e.getMessage(), e);
+                                }
+                            }
 
                        } else {
                            log.error("Service " + clusterInstanceCreatedEvent.getServiceName() +