stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [13/50] [abbrv] git commit: setting hasDependent to monitors based on kill behaviours
Date Thu, 30 Oct 2014 04:13:37 GMT
setting hasDependent to monitors based on kill behaviours


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

Branch: refs/heads/docker-grouping-merge
Commit: aef9c12cbfc204a4a5c85f6c32b6707c21b1683f
Parents: 66aeb30
Author: reka <rthirunavukkarasu23@gmail.com>
Authored: Mon Oct 27 18:29:22 2014 +0530
Committer: reka <rthirunavukkarasu23@gmail.com>
Committed: Mon Oct 27 18:29:22 2014 +0530

----------------------------------------------------------------------
 .../grouping/dependency/DependencyBuilder.java        |  2 +-
 .../dependency/context/ApplicationContext.java        | 12 ++++++++++--
 .../dependency/context/ApplicationContextFactory.java | 14 ++++++++------
 .../autoscaler/monitor/ApplicationMonitorFactory.java |  4 ++--
 .../autoscaler/monitor/cluster/ClusterMonitor.java    |  4 ++--
 5 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/aef9c12c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
index 14fc90e..edd1c02 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
@@ -91,7 +91,7 @@ public class DependencyBuilder {
 
                         if (start != null) {
                             ApplicationContext applicationContext = ApplicationContextFactory.
-                                    getApplicationContext(start, component, dependencyTree.isKillDependent());
+                                    getApplicationContext(start, component, dependencyTree);
                             String id = applicationContext.getId();
 
                             ApplicationContext existingApplicationContext =

http://git-wip-us.apache.org/repos/asf/stratos/blob/aef9c12c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContext.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContext.java
index 45e1655..3197fb9 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContext.java
@@ -38,12 +38,12 @@ public abstract class ApplicationContext {
 
     private Stack<ClusterStatus> statusLifeCycle;
 
-    protected boolean killDependent;
+    protected boolean isDependent;
 
     public ApplicationContext(String id, boolean killDependent) {
         applicationContextList = new ArrayList<ApplicationContext>();
         statusLifeCycle = new Stack<ClusterStatus>();
-        this.killDependent = killDependent;
+        this.setDependent(killDependent);
         this.id = id;
     }
 
@@ -102,4 +102,12 @@ public abstract class ApplicationContext {
     public void setTerminated(boolean terminated) {
         this.terminated = terminated;
     }
+
+    public boolean isDependent() {
+        return isDependent;
+    }
+
+    public void setDependent(boolean isDependent) {
+        this.isDependent = isDependent;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/aef9c12c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContextFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContextFactory.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContextFactory.java
index 970d593..631e5d4 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContextFactory.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/context/ApplicationContextFactory.java
@@ -21,6 +21,7 @@ package org.apache.stratos.autoscaler.grouping.dependency.context;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.Constants;
+import org.apache.stratos.autoscaler.grouping.dependency.DependencyTree;
 import org.apache.stratos.messaging.domain.topology.ClusterDataHolder;
 import org.apache.stratos.messaging.domain.topology.Group;
 import org.apache.stratos.messaging.domain.topology.ParentComponent;
@@ -36,24 +37,25 @@ public class ApplicationContextFactory {
      *
      * @param startOrder      reference of group/cluster in the start order
      * @param component       The component which used to build the dependency
-     * @param isKillDependent kill dependent behaviour of this component
+     * @param tree kill dependent behaviour of this component
      * @return Context
      */
     public static ApplicationContext getApplicationContext(String startOrder,
                                                            ParentComponent component,
-                                                           boolean isKillDependent) {
+                                                           DependencyTree tree) {
         String id;
         ApplicationContext applicationContext = null;
+        boolean isDependent = tree.isKillDependent() || tree.isKillAll();
         if (startOrder.startsWith(Constants.GROUP + ".")) {
             //getting the group alias
             id = getGroupFromStartupOrder(startOrder);
-            applicationContext = getGroupContext(id, isKillDependent);
+            applicationContext = getGroupContext(id, isDependent);
         } else if (startOrder.startsWith(Constants.CARTRIDGE + ".")) {
             //getting the cluster alias
             id = getClusterFromStartupOrder(startOrder);
             //getting the cluster-id from cluster alias
             ClusterDataHolder clusterDataHolder = component.getClusterDataMap().get(id);
-            applicationContext = getClusterContext(clusterDataHolder, isKillDependent);
+            applicationContext = getClusterContext(clusterDataHolder, isDependent);
 
         } else {
             log.warn("[Startup Order]: " + startOrder + " contains unknown reference");
@@ -91,10 +93,10 @@ public class ApplicationContextFactory {
         return  applicationContext;
     }
 
-    public static ApplicationContext getGroupContext(String id, boolean isKillDependent)
{
+    public static ApplicationContext getGroupContext(String id, boolean isDependent) {
         ApplicationContext applicationContext;
         applicationContext = new GroupContext(id,
-                isKillDependent);
+                isDependent);
         return applicationContext;
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/aef9c12c/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 b60e645..2ead896 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
@@ -109,7 +109,7 @@ public class ApplicationMonitorFactory {
             if(parentMonitor != null) {
                 groupMonitor.setParent(parentMonitor);
                 //Setting the dependent behaviour of the monitor
-                if(parentMonitor.hasMonitors() && (parentMonitor.isDependent() ||
context.hasChild())) {
+                if(parentMonitor.isDependent() || (context.isDependent() && context.hasChild()))
{
                     groupMonitor.setHasDependent(true);
                 } else {
                     groupMonitor.setHasDependent(false);
@@ -291,7 +291,7 @@ public class ApplicationMonitorFactory {
 
                 clusterMonitor.addNetworkPartitionCtxt(networkPartitionContext);
                 clusterMonitor.setParent(parentMonitor);
-                if(parentMonitor.hasActiveMonitors() && (parentMonitor.isDependent()
|| context.hasChild())) {
+                if(parentMonitor.isDependent() || (context.isDependent() && context.hasChild()))
{
                     clusterMonitor.setHasDependent(true);
                 } else {
                     clusterMonitor.setHasDependent(false);

http://git-wip-us.apache.org/repos/asf/stratos/blob/aef9c12c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
index 0848d64..557fedb 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/cluster/ClusterMonitor.java
@@ -174,7 +174,7 @@ public class ClusterMonitor extends AbstractClusterMonitor {
 
             }
 
-        	boolean rifReset = networkPartitionContext.isRifReset();
+        	/*boolean rifReset = networkPartitionContext.isRifReset();
             boolean memoryConsumptionReset = networkPartitionContext.isMemoryConsumptionReset();
             boolean loadAverageReset = networkPartitionContext.isLoadAverageReset();
 
@@ -208,7 +208,7 @@ public class ClusterMonitor extends AbstractClusterMonitor {
             } else if (log.isDebugEnabled()) {
                 log.debug(String.format("Scale rule will not run since the LB statistics
have not received before this " +
                         "cycle for network partition %s", networkPartitionContext.getId()));
-            }
+            }*/
         }
     }
 


Mime
View raw message