Repository: stratos Updated Branches: refs/heads/4.1.0-test fb8f23efc -> d64f31438
fixing a build failure due to partial commit Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/590a4f6d Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/590a4f6d Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/590a4f6d Branch: refs/heads/4.1.0-test Commit: 590a4f6dbea74f8fd4074d655b1c522f83fe61a2 Parents: 359d323 Author: reka <[email protected]> Authored: Mon Dec 8 19:20:25 2014 +0530 Committer: reka <[email protected]> Committed: Thu Dec 11 19:20:13 2014 +0530 ---------------------------------------------------------------------- .../component/ParentComponentMonitor.java | 25 ++++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/590a4f6d/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 f2f345a..6156015 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 @@ -104,7 +104,7 @@ public abstract class ParentComponentMonitor extends Monitor { MonitorNotFoundException { //start the first dependency List<ApplicationChildContext> applicationContexts = this.startupDependencyTree. - getStarAbleDependencies(); + getStartAbleDependencies(); startDependency(applicationContexts, instanceId); } @@ -128,7 +128,7 @@ public abstract class ParentComponentMonitor extends Monitor { public void startDependency(ParentComponent component) { //start the first dependency List<ApplicationChildContext> applicationContexts = this.startupDependencyTree. - getStarAbleDependencies(); + getStartAbleDependencies(); Collection<Instance> contexts = component.getInstanceIdToInstanceContextMap().values(); //traversing through all the Instance context and start them List<String> instanceIds = new ArrayList<String>(); @@ -164,10 +164,13 @@ public abstract class ParentComponentMonitor extends Monitor { * by traversing to find the terminated dependencies. * it will get invoked when start a child monitor on termination of a sub tree */ - public void startDependencyOnTermination() throws TopologyInConsistentException { + + public void startDependencyOnTermination(String instanceId) throws TopologyInConsistentException, + MonitorNotFoundException, PolicyValidationException, PartitionValidationException { + //start the first dependency which went to terminated List<ApplicationChildContext> applicationContexts = this.startupDependencyTree. - getStarAbleDependenciesByTermination(); + getStarAbleDependenciesByTermination(this, instanceId); for(ApplicationChildContext context : applicationContexts) { if(context instanceof GroupChildContext) { GroupMonitor groupMonitor = (GroupMonitor) this.aliasToActiveMonitorsMap. @@ -382,7 +385,15 @@ public abstract class ParentComponentMonitor extends Monitor { (parentContexts.isEmpty() || parentsTerminated || allParentsActive)) { //Find the non existent monitor by traversing dependency tree try { - this.startDependencyOnTermination(); + try { + this.startDependencyOnTermination(instanceId); + } catch (MonitorNotFoundException e) { + e.printStackTrace(); + } catch (PolicyValidationException e) { + e.printStackTrace(); + } catch (PartitionValidationException e) { + e.printStackTrace(); + } } catch (TopologyInConsistentException e) { //TODO revert the siblings and notify parent, change a flag for reverting/un-subscription log.error("Error while starting the monitor upon termination" + e); @@ -574,6 +585,10 @@ public abstract class ParentComponentMonitor extends Monitor { return hasMonitor; } + public Monitor getMonitor(String childId) { + return this.aliasToActiveMonitorsMap.get(childId); + } + public boolean hasMonitors() { return this.aliasToActiveMonitorsMap != null;
