Repository: stratos
Updated Branches:
  refs/heads/master 71f0394cf -> 32290c379


Refining dependency tree builder logs


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

Branch: refs/heads/master
Commit: 32290c379f0e928a68a01c91640126585a2933d9
Parents: 71f0394
Author: Imesh Gunaratne <[email protected]>
Authored: Sat Mar 28 18:06:04 2015 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Sat Mar 28 18:06:04 2015 +0530

----------------------------------------------------------------------
 .../dependency/DependencyBuilder.java           | 31 ++++++++++----------
 .../applications/dependency/DependencyTree.java |  7 +----
 .../context/ApplicationChildContextFactory.java |  4 +--
 .../component/ParentComponentMonitor.java       | 18 +++++++-----
 4 files changed, 28 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/32290c37/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyBuilder.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyBuilder.java
index d079283..366171f 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyBuilder.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyBuilder.java
@@ -52,7 +52,7 @@ public class DependencyBuilder {
      * @param component it will give the necessary information to build the 
tree
      * @return the dependency tree out of the dependency orders
      */
-    public DependencyTree buildDependency(String applicationId, 
ParentComponent component)
+    public DependencyTree buildDependency(ParentComponent component)
             throws DependencyBuilderException{
 
         String identifier = component.getUniqueIdentifier();
@@ -60,11 +60,7 @@ public class DependencyBuilder {
         DependencyOrder dependencyOrder = component.getDependencyOrder();
 
         if (dependencyOrder != null) {
-            log.info(String.format("Building dependency tree: [application-id] 
%s [component] %s ",
-                    applicationId, identifier));
-
-            log.info(String.format("Setting termination behaviour: 
[application-id] %s [component] %s ",
-                    applicationId, identifier));
+            log.info(String.format("Building dependency tree: [component] %s 
", identifier));
 
             String terminationBehaviour = 
dependencyOrder.getTerminationBehaviour();
             if 
(AutoscalerConstants.TERMINATE_NONE.equals(terminationBehaviour)) {
@@ -75,26 +71,29 @@ public class DependencyBuilder {
                 
dependencyTree.setTerminationBehavior(DependencyTree.TerminationBehavior.TERMINATE_DEPENDENT);
             }
 
+            log.info(String.format("Termination behaviour set: [component] %s 
[termination-behaviour] %s",
+                    identifier, dependencyTree.getTerminationBehavior()));
+
             Set<StartupOrder> startupOrders = 
dependencyOrder.getStartupOrders();
             ApplicationChildContext parentContext;
 
             if (startupOrders != null) {
-                log.debug(String.format("Processing startup orders: 
[application-id] %s [component] %s " +
-                        "[startup-orders] %s", applicationId, identifier, 
startupOrders));
+                log.debug(String.format("Processing startup orders: 
[component] %s [startup-orders] %s",
+                        identifier, startupOrders));
 
                 for (StartupOrder startupOrder : startupOrders) {
                     parentContext = null;
-                    log.debug(String.format("Processing startup order: 
[application-id] %s [component] %s " +
-                            "[startup-order] %s", applicationId, identifier, 
startupOrder));
+                    log.debug(String.format("Processing startup order: 
[component] %s " +
+                            "[startup-order] %s", identifier, startupOrder));
 
                     for (String startupOrderComponent : 
startupOrder.getStartupOrderComponentList()) {
                         if (startupOrderComponent != null) {
-                            log.debug(String.format("Processing startup order 
element: [application-id] %s " +
+                            log.debug(String.format("Processing startup order 
element: " +
                                             "[component] %s [startup-order] %s 
[element] %s",
-                                    applicationId, identifier, startupOrder, 
startupOrderComponent));
+                                     identifier, startupOrder, 
startupOrderComponent));
 
                             ApplicationChildContext applicationChildContext = 
ApplicationChildContextFactory.
-                                    
createApplicationChildContext(applicationId, startupOrderComponent,
+                                    createApplicationChildContext(identifier, 
startupOrderComponent,
                                             component, dependencyTree);
                             String applicationChildContextId = 
applicationChildContext.getId();
 
@@ -127,7 +126,7 @@ public class DependencyBuilder {
                                     parentContext = 
existingApplicationChildContext;
                                     if (log.isDebugEnabled()) {
                                         log.debug(String.format("Element [%s] 
was found in the dependency tree," +
-                                                " making it the parent context 
and continuing: [dependency-tree] %s",
+                                                " making it the parent and 
continuing: [dependency-tree] %s",
                                                 
existingApplicationChildContext.getId(), dependencyTree));
                                     }
                                 } else {
@@ -139,8 +138,8 @@ public class DependencyBuilder {
                                         // Application child context is 
already available in the dependency tree,
                                         // find its parent element, mark it as 
the parent element and continue
                                         if(log.isDebugEnabled()) {
-                                            log.debug(String.format("Found an 
existing parent context [%s] in the " +
-                                                            "dependency tree, 
making it the parent context " +
+                                            log.debug(String.format("Found an 
existing parent element [%s] in the " +
+                                                            "dependency tree, 
making it the parent " +
                                                             "and continuing: 
[dependency-tree] %s",
                                                     
existingParentContext.getId(), dependencyTree));
                                         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/32290c37/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyTree.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyTree.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyTree.java
index e9641c5..e0da8b6 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyTree.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/DependencyTree.java
@@ -32,16 +32,11 @@ import java.util.List;
  * This is to contain the dependency tree of an application/group
  */
 public class DependencyTree {
+
     private static final Log log = LogFactory.getLog(DependencyTree.class);
 
     private List<ApplicationChildContext> primaryApplicationContextList;
-
     private TerminationBehavior terminationBehavior;
-
-    private boolean startupOder;
-
-    private boolean reverseStartupOrder;
-
     private String id;
 
     public DependencyTree(String id) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/32290c37/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/context/ApplicationChildContextFactory.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/context/ApplicationChildContextFactory.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/context/ApplicationChildContextFactory.java
index fc631b9..13f1139 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/context/ApplicationChildContextFactory.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/dependency/context/ApplicationChildContextFactory.java
@@ -39,7 +39,7 @@ public class ApplicationChildContextFactory {
      * @param tree kill dependent behaviour of this component
      * @return Context
      */
-    public static ApplicationChildContext createApplicationChildContext(String 
applicationId, String startUpOrder,
+    public static ApplicationChildContext createApplicationChildContext(String 
componentId, String startUpOrder,
                                                                         
ParentComponent component,
                                                                         
DependencyTree tree) {
 
@@ -56,7 +56,7 @@ public class ApplicationChildContextFactory {
             return createClusterChildContext(clusterDataHolder, hasDependents);
         } else {
             throw new RuntimeException(String.format("Startup order contains 
an unknown reference: " +
-                            "[application-id] %s [startup-order] %s", 
applicationId, startUpOrder));
+                            "[component] %s [startup-order] %s", componentId, 
startUpOrder));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/32290c37/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
index 14d1c9b..a15557d 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/ParentComponentMonitor.java
@@ -98,19 +98,21 @@ public abstract class ParentComponentMonitor extends 
Monitor implements Runnable
         inactiveInstancesMap = new ConcurrentHashMap<String, List<String>>();
         terminatingInstancesMap = new ConcurrentHashMap<String, 
List<String>>();
         pendingMonitorsList = new ArrayList<String>();
-        //clusterIdToClusterMonitorsMap = new HashMap<String, 
AbstractClusterMonitor>();
-        this.id = component.getUniqueIdentifier();
-        //Building the startup dependencies for this monitor within the 
immediate children
-        startupDependencyTree = 
DependencyBuilder.getInstance().buildDependency(getAppId(), component);
-        //Building the scaling dependencies for this monitor within the 
immediate children
-        if ((component.getDependencyOrder() != null) && 
(component.getDependencyOrder().
-                                                            
getScalingDependents() != null)) {
+        id = component.getUniqueIdentifier();
+
+        // Building the startup dependencies for this monitor within the 
immediate children
+        startupDependencyTree = 
DependencyBuilder.getInstance().buildDependency(id, component);
+
+        // Building the scaling dependencies for this monitor within the 
immediate children
+        if ((component.getDependencyOrder() != null) &&
+                (component.getDependencyOrder().getScalingDependents() != 
null)) {
             scalingDependencies = 
DependencyBuilder.getInstance().buildScalingDependencies(component);
         } else {
             // No scaling dependencies found, initialize to an empty set
             scalingDependencies = new HashSet<ScalingDependentList>();
         }
-        //Create the executor service with identifier and thread pool size
+
+        // Create the executor service with identifier and thread pool size
         executorService = 
StratosThreadPool.getExecutorService(AutoscalerConstants.AUTOSCALER_THREAD_POOL_ID,
                 AutoscalerConstants.AUTOSCALER_THREAD_POOL_SIZE);
         networkPartitionCtxts = new HashMap<String, NetworkPartitionContext>();

Reply via email to