You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2015/05/14 09:51:58 UTC

[2/3] stratos git commit: fixing startup order issue with parallel nodes

fixing startup order issue with parallel nodes


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

Branch: refs/heads/master
Commit: 7deb1127caadb088fd3900c7825975051771bc82
Parents: 8b433aa
Author: reka <rt...@gmail.com>
Authored: Thu May 14 13:02:52 2015 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu May 14 13:21:45 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/applications/dependency/DependencyBuilder.java  | 6 ++++--
 .../autoscaler/applications/dependency/DependencyTree.java     | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7deb1127/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 df453dc..7d3b59e 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
@@ -143,7 +143,9 @@ public class DependencyBuilder {
                                     ApplicationChildContext existingParentContext =
                                             dependencyTree.findParentContextWithId(applicationChildContext.getId());
                                     if ((existingParentContext != null) &&
-                                            (existingParentContext.getId().equals(existingApplicationChildContext.getId()))) {
+                                            (existingApplicationChildContext.getParent()) != null &&
+                                            (existingParentContext.getId().
+                                                    equals(existingApplicationChildContext.getParent().getId()))) {
                                         // 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()) {
@@ -152,7 +154,7 @@ public class DependencyBuilder {
                                                             "and continuing: [dependency-tree] %s",
                                                     existingParentContext.getId(), dependencyTree));
                                         }
-                                        parentContext = existingParentContext;
+                                        parentContext = existingApplicationChildContext;
                                     } else {
                                         String msg = "Startup order is not valid. It contains an element " +
                                                 "which has been defined more than once in another startup order: " +

http://git-wip-us.apache.org/repos/asf/stratos/blob/7deb1127/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 693a963..56e9e1d 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
@@ -86,7 +86,11 @@ public class DependencyTree {
         }
         //if not found in the top level search recursively
         for (ApplicationChildContext context : contexts) {
-            return getApplicationChildContextById(id, context.getApplicationChildContextList());
+            ApplicationChildContext childContext = getApplicationChildContextById(id,
+                    context.getApplicationChildContextList());
+            if(childContext != null) {
+                return childContext;
+            }
         }
         return null;
     }