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/11/15 11:05:57 UTC

stratos git commit: Rename dependent to startupDependent

Repository: stratos
Updated Branches:
  refs/heads/master dcef1b5ea -> 90e38c2e4


Rename dependent to startupDependent


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

Branch: refs/heads/master
Commit: 90e38c2e44d6374ad2808124b9ee90c0ee75eeba
Parents: dcef1b5
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Sat Nov 15 15:36:33 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Sat Nov 15 15:36:33 2014 +0530

----------------------------------------------------------------------
 .../apache/stratos/autoscaler/monitor/Monitor.java  | 16 +++++++++-------
 .../autoscaler/monitor/ParentComponentMonitor.java  |  4 ++--
 .../application/ApplicationMonitorFactory.java      | 14 +++++++-------
 .../monitor/cluster/AbstractClusterMonitor.java     |  2 +-
 .../monitor/cluster/VMServiceClusterMonitor.java    |  2 +-
 .../autoscaler/monitor/group/GroupMonitor.java      |  2 +-
 .../autoscaler/status/checker/StatusChecker.java    |  2 +-
 7 files changed, 22 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/Monitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/Monitor.java
index ee9362a..be66727 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/Monitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/Monitor.java
@@ -39,7 +39,9 @@ public abstract class Monitor implements EventHandler {
     // this monitor decided by its parent
     protected boolean terminateChildren = false;
 
-    protected boolean hasDependent;
+    protected boolean hasStartupDependents;
+
+    protected boolean hasScalingDependents;
 
     public String getId() {
         return id;
@@ -88,18 +90,18 @@ public abstract class Monitor implements EventHandler {
         return this.aliasToActiveMonitorsMap != null || this.inactiveMonitorsList != null;
     }
 
-    public boolean hasDependents() {
-        return hasDependent;
+    public boolean hasStartupDependents() {
+        return hasStartupDependents;
     }
 
-    public void setHasDependent(boolean hasDependent) {
-        this.hasDependent = hasDependent;
+    public void setHasStartupDependents(boolean hasDependent) {
+        this.hasStartupDependents = hasDependent;
     }
 
-    public boolean hasInDependentChild() {
+    public boolean hasIndependentChild() {
         boolean hasInDepChild = false;
         for (Monitor monitor : this.aliasToActiveMonitorsMap.values()) {
-            if (!monitor.hasDependents()) {
+            if (!monitor.hasStartupDependents()) {
                 hasInDepChild = true;
                 break;
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
index 1e536a6..9443c92 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ParentComponentMonitor.java
@@ -90,7 +90,7 @@ public abstract class ParentComponentMonitor extends Monitor {
     }
 
     /*protected void onChildTerminatingEvent(String idOfEvent) {
-        //Check whether hasDependent true
+        //Check whether hasStartupDependents true
         if (!this.aliasToInactiveMonitorsMap.containsKey(idOfEvent)) {
             this.aliasToInactiveMonitorsMap.put(idOfEvent, this.aliasToActiveMonitorsMap.remove(idOfEvent));
         }
@@ -128,7 +128,7 @@ public abstract class ParentComponentMonitor extends Monitor {
         List<ApplicationChildContext> terminationList;
         Monitor monitor;
 
-        if (this.hasDependent) {
+        if (this.hasStartupDependents) {
             //need to notify the parent
             StatusChecker.getInstance().onChildStatusChange(eventId, this.id, this.appId);
         } else {

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitorFactory.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitorFactory.java
index 06246da..7e36507 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitorFactory.java
@@ -100,10 +100,10 @@ public class ApplicationMonitorFactory {
             if (parentMonitor != null) {
                 groupMonitor.setParent(parentMonitor);
                 //Setting the dependent behaviour of the monitor
-                if (parentMonitor.hasDependents() || (context.hasStartupDependents() && context.hasChild())) {
-                    groupMonitor.setHasDependent(true);
+                if (parentMonitor.hasStartupDependents() || (context.hasStartupDependents() && context.hasChild())) {
+                    groupMonitor.setHasStartupDependents(true);
                 } else {
-                    groupMonitor.setHasDependent(false);
+                    groupMonitor.setHasStartupDependents(false);
                 }
                 //TODO make sure when it is async
 
@@ -140,7 +140,7 @@ public class ApplicationMonitorFactory {
             Application application = ApplicationHolder.getApplications().getApplication(appId);
             if (application != null) {
                 applicationMonitor = new ApplicationMonitor(application);
-                applicationMonitor.setHasDependent(false);
+                applicationMonitor.setHasStartupDependents(false);
 
             } else {
                 String msg = "[Application] " + appId + " cannot be found in the Topology";
@@ -196,10 +196,10 @@ public class ApplicationMonitorFactory {
             clusterMonitor.setParent(parentMonitor);
             clusterMonitor.setId(clusterId);
             //setting the dependent behaviour of the cluster monitor
-            if(parentMonitor.hasDependents() || (context.hasStartupDependents() && context.hasChild())) {
-                clusterMonitor.setHasDependent(true);
+            if(parentMonitor.hasStartupDependents() || (context.hasStartupDependents() && context.hasChild())) {
+                clusterMonitor.setHasStartupDependents(true);
             } else {
-                clusterMonitor.setHasDependent(false);
+                clusterMonitor.setHasStartupDependents(false);
             }
             //setting the status of the cluster, if it doesn't match with Topology cluster status.
             if (cluster.getStatus() != clusterMonitor.getStatus()) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
index 1dd68ac..d70a5bc 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/AbstractClusterMonitor.java
@@ -231,7 +231,7 @@ public abstract class AbstractClusterMonitor extends Monitor implements Runnable
              * If the cluster in_active and if it is a in_dependent cluster,
              * then won't send the notification to parent.
              */
-            if (status == ClusterStatus.Inactive && !this.hasDependent) {
+            if (status == ClusterStatus.Inactive && !this.hasStartupDependents) {
                 log.info("[Cluster] " + clusterId + "is not notifying the parent, " +
                         "since it is identified as the independent unit");
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMServiceClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMServiceClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMServiceClusterMonitor.java
index 7684bb8..c88166d 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMServiceClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/VMServiceClusterMonitor.java
@@ -65,7 +65,7 @@ public class VMServiceClusterMonitor extends VMClusterMonitor {
         while (!isDestroyed()) {
             try {
                 if  (((getStatus().getCode() <= ClusterStatus.Active.getCode()) ||
-                        (getStatus() == ClusterStatus.Inactive && !hasDependent)) && !this.hasFaultyMember
+                        (getStatus() == ClusterStatus.Inactive && !hasStartupDependents)) && !this.hasFaultyMember
                         && !stop) {
                     if (log.isDebugEnabled()) {
                         log.debug("Cluster monitor is running.. " + this.toString());

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
index 55ef36f..a4a8b48 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
@@ -158,7 +158,7 @@ public class GroupMonitor extends ParentComponentMonitor implements EventHandler
         //if(this.status != status) {
         this.status = status;
         //notifying the parent
-        if (status == GroupStatus.Inactive && !this.hasDependent) {
+        if (status == GroupStatus.Inactive && !this.hasStartupDependents) {
             log.info("[Group] " + this.id + "is not notifying the parent, " +
                     "since it is identified as the independent unit");
         } else {

http://git-wip-us.apache.org/repos/asf/stratos/blob/90e38c2e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
index bab95e9..b686dc0 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
@@ -200,7 +200,7 @@ public class StatusChecker {
                 String appId = monitor.getAppId();
                 if (clusterInActive) {
                     //if the monitor is dependent, temporarily pausing it
-                    if (monitor.hasDependents()) {
+                    if (monitor.hasStartupDependents()) {
                         monitor.setHasFaultyMember(true);
                     }
                     //send cluster In-Active event to cluster status topic