Repository: stratos
Updated Branches:
  refs/heads/master ea340d311 -> 1089dedc6


fixing clusters initialize issue upon complete topology event


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

Branch: refs/heads/master
Commit: b91b86c39034565d5d16d9c47658f3103c9adf14
Parents: ea340d3
Author: reka <[email protected]>
Authored: Thu Jun 25 19:27:16 2015 +0530
Committer: reka <[email protected]>
Committed: Thu Jun 25 19:27:16 2015 +0530

----------------------------------------------------------------------
 .../AutoscalerTopologyEventReceiver.java        | 28 ++++++++-------
 .../builder/MonitorStatusEventBuilder.java      | 37 --------------------
 2 files changed, 16 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b91b86c3/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 0ae4385..1481440 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
@@ -89,22 +89,26 @@ public class AutoscalerTopologyEventReceiver {
                         ApplicationHolder.acquireReadLock();
                         Applications applications = 
ApplicationHolder.getApplications();
                         if (applications != null) {
-                            for (Application application : 
applications.getApplications().values()) {
-                                if 
(AutoscalerUtil.allClustersInitialized(application)) {
-                                    ApplicationContext applicationContext = 
AutoscalerContext.getInstance().
-                                            
getApplicationContext(application.getUniqueIdentifier());
-                                    if (applicationContext != null && 
applicationContext.getStatus().equals(
-                                            
ApplicationContext.STATUS_DEPLOYED)) {
-                                        
AutoscalerUtil.getInstance().startApplicationMonitor(application.getUniqueIdentifier());
-                                    } else {
-                                        log.info("The application is not yet " 
+
-                                                "deployed for this 
[application] " +
+                            for (Application application : applications.
+                                    getApplications().values()) {
+                                ApplicationContext applicationContext =
+                                        AutoscalerContext.getInstance().
+                                        
getApplicationContext(application.getUniqueIdentifier());
+                                if (applicationContext != null && 
applicationContext.getStatus().
+                                        
equals(ApplicationContext.STATUS_DEPLOYED)) {
+                                    if 
(AutoscalerUtil.allClustersInitialized(application)) {
+                                        
AutoscalerUtil.getInstance().startApplicationMonitor(
                                                 
application.getUniqueIdentifier());
+                                    } else {
+                                        log.error("Complete Topology is not 
consistent with " +
+                                                "the applications which got 
persisted");
                                     }
                                 } else {
-                                    log.error("Complete Topology is not 
consistent with the applications " +
-                                            "which got persisted");
+                                    log.info("The application is not yet " +
+                                            "deployed for this [application] " 
+
+                                            application.getUniqueIdentifier());
                                 }
+
                             }
                             topologyInitialized = true;
                         } else {

http://git-wip-us.apache.org/repos/asf/stratos/blob/b91b86c3/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/events/builder/MonitorStatusEventBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/events/builder/MonitorStatusEventBuilder.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/events/builder/MonitorStatusEventBuilder.java
index abe1c57..a3da9af 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/events/builder/MonitorStatusEventBuilder.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/events/builder/MonitorStatusEventBuilder.java
@@ -24,7 +24,6 @@ import 
org.apache.stratos.autoscaler.exception.application.MonitorNotFoundExcept
 import org.apache.stratos.autoscaler.monitor.Monitor;
 import org.apache.stratos.autoscaler.monitor.component.ParentComponentMonitor;
 import org.apache.stratos.autoscaler.monitor.events.*;
-import org.apache.stratos.messaging.domain.application.ApplicationStatus;
 import org.apache.stratos.messaging.domain.application.GroupStatus;
 import org.apache.stratos.messaging.domain.topology.ClusterStatus;
 
@@ -46,12 +45,6 @@ public class MonitorStatusEventBuilder {
         notifyParent(parent, groupStatusEvent);
     }
 
-    public static void handleApplicationStatusEvent(ParentComponentMonitor 
parent, ApplicationStatus status,
-                                                    String appId, String 
instanceId) {
-        ApplicationStatusEvent applicationStatusEvent = new 
ApplicationStatusEvent(status, appId, instanceId);
-        notifyParent(parent, applicationStatusEvent);
-    }
-
     public static void handleClusterScalingEvent(ParentComponentMonitor parent,
                                                  String networkPartitionId, 
String instanceId, float factor,
                                                  String id) {
@@ -93,29 +86,6 @@ public class MonitorStatusEventBuilder {
         }
     }
 
-    public static void notifyChildGroup(Monitor child, GroupStatus state, 
String instanceId)
-            throws MonitorNotFoundException {
-        MonitorStatusEvent statusEvent = new GroupStatusEvent(state, 
child.getId(), instanceId);
-        child.onParentStatusEvent(statusEvent);
-    }
-
-    /*public static void notifyChildCluster(Monitor child, ClusterStatus 
state, List<String> instanceId) {
-        MonitorStatusEvent statusEvent = new ClusterStatusEvent(state, 
instanceId, child.getApplicationId());
-        child.onParentStatusEvent(statusEvent);
-    }
-
-    public static void notifyChildGroup(Monitor child, GroupStatus state, 
List<String> instanceIds)
-            throws ParentMonitorNotFoundException {
-        MonitorStatusEvent statusEvent = new GroupStatusEvent(state, 
child.getApplicationId(), instanceIds);
-        child.onParentStatusEvent(statusEvent);
-    }*/
-
-    public static void notifyChildCluster(Monitor child, ClusterStatus state, 
String instanceId)
-            throws MonitorNotFoundException {
-        MonitorStatusEvent statusEvent = new ClusterStatusEvent(state, 
child.getId(), instanceId);
-        child.onParentStatusEvent(statusEvent);
-    }
-
     private static void notifyParent(ParentComponentMonitor parent, 
ScalingEvent scalingEvent) {
         parent.onChildScalingEvent(scalingEvent);
     }
@@ -127,11 +97,4 @@ public class MonitorStatusEventBuilder {
     private static void notifyParent(ParentComponentMonitor parent, 
ScalingUpBeyondMaxEvent scalingUpBeyondMaxEvent) {
         parent.onChildScalingOverMaxEvent(scalingUpBeyondMaxEvent);
     }
-
-    public static void notifyChildren(ParentComponentMonitor componentMonitor, 
ScalingEvent scalingEvent) {
-        for (Monitor activeChildMonitor : 
componentMonitor.getAliasToActiveChildMonitorsMap().values()) {
-            activeChildMonitor.onParentScalingEvent(scalingEvent);
-        }
-    }
-
 }

Reply via email to