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/66732bc0 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/66732bc0 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/66732bc0 Branch: refs/heads/master Commit: 66732bc065ffb18cb311970b287da855fa78ff39 Parents: 5ef677c Author: reka <[email protected]> Authored: Wed Dec 17 15:18:32 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Thu Dec 18 12:06:59 2014 +0530 ---------------------------------------------------------------------- .../dependency/DependencyBuilder.java | 21 ++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/66732bc0/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); + } + } }
