Repository: stratos
Updated Branches:
  refs/heads/4.1.0-test 3f63a0639 -> 999ff7bd7


supporting parallel startup in the dependency tree


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

Branch: refs/heads/4.1.0-test
Commit: 999ff7bd757216028c4b648a368ded3efd96b7eb
Parents: 3f63a06
Author: reka <[email protected]>
Authored: Wed Dec 17 15:18:32 2014 +0530
Committer: reka <[email protected]>
Committed: Thu Dec 18 10:30:05 2014 +0530

----------------------------------------------------------------------
 .../dependency/DependencyBuilder.java           | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/999ff7bd/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 98d2dc4..8c6921f 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
@@ -111,16 +111,29 @@ public class DependencyBuilder {
                                 if (parentContext == null) {
                                     //if existing context found, add it to 
child of existing context and
                                     //set the existing context as the next 
parent
-                                    
existingApplicationContext.addApplicationContext(applicationContext);
+                                    
//existingApplicationContext.addApplicationContext(applicationContext);
                                     parentContext = existingApplicationContext;
                                     if (log.isDebugEnabled()) {
                                         log.debug("Found an existing 
[dependency] " + id + " and setting it " +
                                                 "for the next dependency to 
follow");
                                     }
                                 } else {
-                                    String msg = "Startup order is not 
consistent. It contains the group/cluster " +
-                                            "which has been used more than one 
in another startup order";
-                                    throw new DependencyBuilderException(msg);
+                                    ApplicationChildContext 
existingParentContext =
+                                            
dependencyTree.findParentContextWithId(
+                                                    
applicationContext.getId());
+                                    if(existingParentContext != null && 
existingParentContext.getId().
+                                            equals(parentContext.getId())) {
+                                        if(log.isDebugEnabled()) {
+                                            log.debug("Found an existing 
parent Context. " +
+                                                    "Hence skipping it and 
parsing the next value.");
+                                        }
+                                        parentContext = 
existingApplicationContext;
+                                    } else {
+                                        String msg = "Startup order is not 
consistent. It contains the group/cluster " +
+                                                "which has been used more than 
one in another startup order";
+                                        throw new 
DependencyBuilderException(msg);
+                                    }
+
                                 }
 
                             }

Reply via email to