stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [11/50] [abbrv] git commit: fixing fault handling and fixing when setting hasDependent to child monitors
Date Thu, 30 Oct 2014 04:13:35 GMT
fixing fault handling and fixing when setting hasDependent to child monitors


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

Branch: refs/heads/docker-grouping-merge
Commit: 1b224bd86e726db82ee92b155c53c4486fd7fec8
Parents: 0300d17
Author: reka <rthirunavukkarasu23@gmail.com>
Authored: Mon Oct 27 15:29:13 2014 +0530
Committer: reka <rthirunavukkarasu23@gmail.com>
Committed: Mon Oct 27 15:29:44 2014 +0530

----------------------------------------------------------------------
 .../health/AutoscalerHealthStatEventReceiver.java        |  2 +-
 .../autoscaler/monitor/AbstractClusterMonitor.java       |  5 ++++-
 .../autoscaler/monitor/ApplicationMonitorFactory.java    | 11 +++++++++--
 .../org/apache/stratos/autoscaler/monitor/Monitor.java   |  4 ++--
 4 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/1b224bd8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
index f090fcb..6986fbb 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatEventReceiver.java
@@ -494,7 +494,7 @@ public class AutoscalerHealthStatEventReceiver implements Runnable {
             }
             return null;
         }
-        return null;
+        return monitor;
     }
 
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/1b224bd8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractClusterMonitor.java
index e816a42..838929c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/AbstractClusterMonitor.java
@@ -234,8 +234,11 @@ abstract public 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.hasDependent)) {
             MonitorStatusEventBuilder.handleClusterStatusEvent(this.parent, this.status,
this.clusterId);
+        } else {
+            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/1b224bd8/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ApplicationMonitorFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ApplicationMonitorFactory.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ApplicationMonitorFactory.java
index 92b3eb8..b60e645 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ApplicationMonitorFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/ApplicationMonitorFactory.java
@@ -108,8 +108,11 @@ public class ApplicationMonitorFactory {
             groupMonitor.setAppId(appId);
             if(parentMonitor != null) {
                 groupMonitor.setParent(parentMonitor);
-                if(!parentMonitor.isHasDependent() && !context.hasChild()) {
+                //Setting the dependent behaviour of the monitor
+                if(parentMonitor.hasMonitors() && (parentMonitor.isDependent() ||
context.hasChild())) {
                     groupMonitor.setHasDependent(true);
+                } else {
+                    groupMonitor.setHasDependent(false);
                 }
                 //TODO make sure when it is async
 
@@ -146,6 +149,8 @@ public class ApplicationMonitorFactory {
             Application application = TopologyManager.getTopology().getApplication(appId);
             if (application != null) {
                 applicationMonitor = new ApplicationMonitor(application);
+                applicationMonitor.setHasDependent(false);
+
             } else {
                 String msg = "[Application] " + appId + " cannot be found in the Topology";
                 throw new TopologyInConsistentException(msg);
@@ -286,8 +291,10 @@ public class ApplicationMonitorFactory {
 
                 clusterMonitor.addNetworkPartitionCtxt(networkPartitionContext);
                 clusterMonitor.setParent(parentMonitor);
-                if(!parentMonitor.isHasDependent() && !context.hasChild()) {
+                if(parentMonitor.hasActiveMonitors() && (parentMonitor.isDependent()
|| context.hasChild())) {
                     clusterMonitor.setHasDependent(true);
+                } else {
+                    clusterMonitor.setHasDependent(false);
                 }
                 AutoscalerContext.getInstance().addMonitor(clusterMonitor);
                 if (log.isInfoEnabled()) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/1b224bd8/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 7199ee8..b1e2eb3 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
@@ -75,7 +75,7 @@ public abstract class Monitor implements EventHandler {
 
     public boolean hasActiveMonitors() {
         boolean hasMonitor = false;
-        if(this.aliasToActiveMonitorsMap != null ) {
+        if(this.aliasToActiveMonitorsMap != null && !this.aliasToActiveMonitorsMap.isEmpty())
{
             hasMonitor = true;
         }
         return hasMonitor;
@@ -86,7 +86,7 @@ public abstract class Monitor implements EventHandler {
         return this.aliasToActiveMonitorsMap != null || this.aliasToInActiveMonitorsMap !=
null;
     }
 
-    public boolean isHasDependent() {
+    public boolean isDependent() {
         return hasDependent;
     }
 


Mime
View raw message