You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/12/14 17:15:21 UTC

[1/3] stratos git commit: Add on child scaling logic to App monitor

Repository: stratos
Updated Branches:
  refs/heads/4.1.0-test 7bbca7b3f -> 9da7f40e6


Add on child scaling logic to App monitor


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

Branch: refs/heads/4.1.0-test
Commit: 048e0f7a6325d4ecc7798501c3907c28bec28c33
Parents: 7bbca7b
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Sun Dec 14 21:43:26 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Sun Dec 14 21:43:26 2014 +0530

----------------------------------------------------------------------
 .../monitor/component/ApplicationMonitor.java   | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/048e0f7a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java
index 66145a7..7f49ea1 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ApplicationMonitor.java
@@ -29,6 +29,7 @@ import org.apache.stratos.autoscaler.exception.application.MonitorNotFoundExcept
 import org.apache.stratos.autoscaler.exception.application.TopologyInConsistentException;
 import org.apache.stratos.autoscaler.exception.policy.PolicyValidationException;
 import org.apache.stratos.autoscaler.monitor.Monitor;
+import org.apache.stratos.autoscaler.monitor.cluster.VMClusterMonitor;
 import org.apache.stratos.autoscaler.monitor.events.ApplicationStatusEvent;
 import org.apache.stratos.autoscaler.monitor.events.MonitorScalingEvent;
 import org.apache.stratos.autoscaler.monitor.events.MonitorStatusEvent;
@@ -40,6 +41,7 @@ import org.apache.stratos.autoscaler.util.ServiceReferenceHolder;
 import org.apache.stratos.messaging.domain.applications.Application;
 import org.apache.stratos.messaging.domain.applications.ApplicationStatus;
 import org.apache.stratos.messaging.domain.applications.GroupStatus;
+import org.apache.stratos.messaging.domain.applications.ScalingDependentList;
 import org.apache.stratos.messaging.domain.instance.ApplicationInstance;
 import org.apache.stratos.messaging.domain.topology.ClusterStatus;
 import org.apache.stratos.messaging.domain.topology.lifecycle.LifeCycleState;
@@ -176,6 +178,38 @@ public class ApplicationMonitor extends ParentComponentMonitor {
     @Override
     public void onChildScalingEvent(MonitorScalingEvent scalingEvent) {
 
+
+        if (log.isDebugEnabled()) {
+            log.debug("Child scaling event received to [group]: " + this.getId()
+                    + ", [network partition]: " + scalingEvent.getNetworkPartitionId()
+                    + ", [event] " + scalingEvent.getId() + ", [group instance] " + scalingEvent.getInstanceId());
+        }
+
+        //find the child context of this group,
+        //Notifying children, if this group has scaling dependencies
+        if(scalingDependencies != null && !scalingDependencies.isEmpty()) {
+            // has dependencies. Notify children
+            if (aliasToActiveMonitorsMap != null && !aliasToActiveMonitorsMap.values().isEmpty()) {
+
+                for (ScalingDependentList scalingDependentList : scalingDependencies) {
+
+                    for(String scalingDependentListComponent : scalingDependentList.getScalingDependentListComponents()){
+
+                        if(scalingDependentListComponent.equals(scalingEvent.getId())){
+
+                            for(String scalingDependentListComponentInSelectedList : scalingDependentList.getScalingDependentListComponents()){
+
+                                Monitor monitor = aliasToActiveMonitorsMap.get(scalingDependentListComponentInSelectedList);
+                                if(monitor instanceof GroupMonitor || monitor instanceof VMClusterMonitor){
+                                    monitor.onParentScalingEvent(scalingEvent);
+                                }
+                            }
+                            break;
+                        }
+                    }
+                }
+            }
+        }
     }
 
     @Override


[2/3] stratos git commit: s/isHasScalingDependants/hasScalingDependants

Posted by la...@apache.org.
s/isHasScalingDependants/hasScalingDependants


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

Branch: refs/heads/4.1.0-test
Commit: 24637e4d5da985b5959fb7587407a9965366285c
Parents: 048e0f7
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Sun Dec 14 21:46:20 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Sun Dec 14 21:46:20 2014 +0530

----------------------------------------------------------------------
 .../autoscaler/context/cluster/ClusterInstanceContext.java       | 2 +-
 .../modules/distribution/src/main/conf/drools/scaling.drl        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/24637e4d/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
index a1f2a1c..95e4a0c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
@@ -464,7 +464,7 @@ public class ClusterInstanceContext extends InstanceContext {
         return averageRequestServedPerInstanceReset;
     }
 
-	public boolean isHasScalingDependants() {
+	public boolean hasScalingDependants() {
 		return hasScalingDependants;
 	}
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/24637e4d/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
----------------------------------------------------------------------
diff --git a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
index d657cc8..a73f180 100644
--- a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
+++ b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl
@@ -136,8 +136,8 @@ dialect "mvel"
 
                         log.info("[scale-up] Partition available, hence trying to spawn an instance to scale up!" );
                         log.debug("[scale-up] " + " [partition] " + partitionContext.getPartitionId() + " [cluster] " + clusterId );
-                        log.debug("[scale-up] " + " has scaling dependents " + clusterInstanceContext.isHasScalingDependants() + " [cluster] " + clusterId );
-                        if(clusterInstanceContext.isHasScalingDependants()) {
+                        log.debug("[scale-up] " + " has scaling dependents " + clusterInstanceContext.hasScalingDependants() + " [cluster] " + clusterId );
+                        if(clusterInstanceContext.hasScalingDependants()) {
 
                         	delegator.delegateScalingDependencyNotification(clusterId, clusterInstanceContext.getNetworkPartitionId(), clusterInstanceContext.getId(), factor);
                         } else {


[3/3] stratos git commit: Adding same child to send onParentScalingEvent

Posted by la...@apache.org.
Adding same child to send onParentScalingEvent


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

Branch: refs/heads/4.1.0-test
Commit: 9da7f40e6c00f657002b1672ab4cc52a6dbd6ee5
Parents: 24637e4
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Sun Dec 14 21:47:05 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Sun Dec 14 21:47:05 2014 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/monitor/component/GroupMonitor.java  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/9da7f40e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
index 1ed28d0..2fc0018 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
@@ -276,12 +276,9 @@ public class GroupMonitor extends ParentComponentMonitor implements Runnable {
 
                             for(String scalingDependentListComponentInSelectedList : scalingDependentList.getScalingDependentListComponents()){
 
-                                if(!scalingDependentListComponent.equals(scalingDependentListComponentInSelectedList)){
-
-                                    Monitor monitor = aliasToActiveMonitorsMap.get(scalingDependentListComponentInSelectedList);
-                                    if(monitor instanceof GroupMonitor || monitor instanceof VMClusterMonitor){
-                                        monitor.onParentScalingEvent(scalingEvent);
-                                    }
+                                Monitor monitor = aliasToActiveMonitorsMap.get(scalingDependentListComponentInSelectedList);
+                                if(monitor instanceof GroupMonitor || monitor instanceof VMClusterMonitor){
+                                    monitor.onParentScalingEvent(scalingEvent);
                                 }
                             }
                             break;