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 2014/10/13 08:19:16 UTC
[1/2] git commit: fixing the calculating activation for application
and group
Repository: stratos
Updated Branches:
refs/heads/4.0.0-grouping c063ac59f -> d7940c640
fixing the calculating activation for application and group
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/34c141ce
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/34c141ce
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/34c141ce
Branch: refs/heads/4.0.0-grouping
Commit: 34c141ce7b21eb7a74f07df3dca491a492a6e475
Parents: a456b4e
Author: reka <rt...@gmail.com>
Authored: Mon Oct 13 11:48:50 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Mon Oct 13 11:48:50 2014 +0530
----------------------------------------------------------------------
.../grouping/dependency/DependencyBuilder.java | 18 ++----
.../monitor/application/ApplicationMonitor.java | 6 +-
.../autoscaler/monitor/group/GroupMonitor.java | 6 +-
.../status/checker/StatusChecker.java | 62 ++++++++++++++++----
4 files changed, 65 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/34c141ce/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
index 275b8c3..71c73a2 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/dependency/DependencyBuilder.java
@@ -61,10 +61,7 @@ public class DependencyBuilder {
DependencyOrder dependencyOrder = component.getDependencyOrder();
if (dependencyOrder != null) {
- if (log.isDebugEnabled()) {
- log.debug("Building dependency for the Application/Group " +
- identifier);
- }
+ log.info("Building dependency for the Application/Group " + identifier);
//Parsing the kill behaviour
String killBehavior = dependencyOrder.getKillbehavior();
@@ -76,21 +73,16 @@ public class DependencyBuilder {
} else if (Constants.KILL_DEPENDENTS.equals(killBehavior)) {
dependencyTree.setKillDependent(true);
}
- if (log.isDebugEnabled()) {
- log.debug("Setting the [killBehavior] " + killBehavior + " to the " +
+
+ log.info("Setting the [killBehavior] " + killBehavior + " to the " +
"[dependency-tree] " + dependencyTree.getId());
- }
+
//Parsing the start up order
Set<StartupOrder> startupOrders = dependencyOrder.getStartupOrders();
ApplicationContext foundContext;
ApplicationContext parentContext;
- /*if (startupOrders == null) {
- if (log.isDebugEnabled()) {
- log.debug("startupOrders is null, returning default dependency tree (empty)");
- }
- return dependencyTree;
- }*/
+
if (startupOrders != null) {
for (StartupOrder startupOrder : startupOrders) {
foundContext = null;
http://git-wip-us.apache.org/repos/asf/stratos/blob/34c141ce/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitor.java
index 01422cc..7a73e2b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/application/ApplicationMonitor.java
@@ -254,13 +254,17 @@ public class ApplicationMonitor extends Monitor {
try {
//if life cycle is empty, need to start the monitor
boolean startDep = startDependency(statusEvent.getId());
+ if(log.isDebugEnabled()) {
+ log.debug("started a child: " + startDep + " by the group/cluster: " + id);
+
+ }
//updating the life cycle and current status
context.setStatus(statusEvent.getStatus());
context.addStatusToLIfeCycle(statusEvent.getStatus());
if(!startDep) {
//Checking in the children whether all are active,
// since no dependency found to be started.
- StatusChecker.getInstance().onChildStatusChange(id, this.component, this.appId);
+ StatusChecker.getInstance().onChildStatusChange(id, this.appId);
}
} catch (TopologyInConsistentException e) {
//TODO revert the siblings and notify parent, change a flag for reverting/un-subscription
http://git-wip-us.apache.org/repos/asf/stratos/blob/34c141ce/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
index 90876cb..5803822 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/group/GroupMonitor.java
@@ -85,15 +85,17 @@ public class GroupMonitor extends Monitor implements EventHandler {
try {
//if life cycle is empty, need to start the monitor
boolean startDep = startDependency(statusEvent.getId());
- log.info("started a child: " + startDep + " by the group/cluster: " + id);
+ if(log.isDebugEnabled()) {
+ log.debug("started a child: " + startDep + " by the group/cluster: " + id);
+ }
//updating the life cycle and current status
context.setStatus(statusEvent.getStatus());
context.addStatusToLIfeCycle(statusEvent.getStatus());
if(!startDep) {
//Checking in the children whether all are active,
// since no dependency found to be started.
- StatusChecker.getInstance().onChildStatusChange(id, this.component, this.appId);
+ StatusChecker.getInstance().onChildStatusChange(id, this.id, this.appId);
}
} catch (TopologyInConsistentException e) {
//TODO revert the siblings and notify parent, change a flag for reverting/un-subscription
http://git-wip-us.apache.org/repos/asf/stratos/blob/34c141ce/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
index 4607f47..16c294a 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/checker/StatusChecker.java
@@ -85,22 +85,34 @@ public class StatusChecker {
}
/**
+ *
* @param idOfChild
- * @param component
+ * @param groupId
+ * @param appId
*/
- public void onChildStatusChange(final String idOfChild, final ParentComponent component,
+ public void onChildStatusChange(final String idOfChild, final String groupId,
final String appId) {
- updateChild(idOfChild, component, appId);
+ updateChild(idOfChild, groupId, appId);
+ }
+
+ /**
+ * This will calculate whether the children of an application are active or not. If active, then
+ * it will send the ApplicationActivatedEvent.
+ * @param idOfChild
+ * @param appId
+ */
+ public void onChildStatusChange(final String idOfChild, final String appId) {
+ updateChild(idOfChild, appId);
}
- private void updateChild(final String idOfChild, final ParentComponent component, final String appId) {
+ private void updateChild(final String idOfChild, final String groupId, final String appId) {
Runnable group = new Runnable() {
public void run() {
try {
//TODO getting lock
TopologyManager.acquireReadLockForApplication(appId);
ParentComponent component1 = TopologyManager.getTopology().
- getApplication(appId).getGroupRecursively(component.getUniqueIdentifier());
+ getApplication(appId).getGroupRecursively(groupId);
Map<String, ClusterDataHolder> clusterIds = component1.getClusterDataMap();
Map<String, Group> groups = component1.getAliasToGroupMap();
updateChildStatus(appId, idOfChild, groups, clusterIds, component1);
@@ -115,6 +127,29 @@ public class StatusChecker {
groupThread.start();
}
+ private void updateChild(final String idOfChild, final String appId) {
+ Runnable group = new Runnable() {
+ public void run() {
+ try {
+ //TODO getting lock
+ TopologyManager.acquireReadLockForApplication(appId);
+ ParentComponent component = TopologyManager.getTopology().
+ getApplication(appId);
+ Map<String, ClusterDataHolder> clusterIds = component.getClusterDataMap();
+ Map<String, Group> groups = component.getAliasToGroupMap();
+ updateChildStatus(appId, idOfChild, groups, clusterIds, component);
+ } finally {
+ TopologyManager.releaseReadLockForApplication(appId);
+
+ }
+
+ }
+ };
+ Thread groupThread = new Thread(group);
+ groupThread.start();
+ }
+
+
/**
* @param clusterId
* @param appId
@@ -157,6 +192,15 @@ public class StatusChecker {
faultHandlingThread.start();
}
+ /**
+ * This will use to calculate whether all children of a particular component is active by travesing Top
+ * @param appId
+ * @param id
+ * @param groups
+ * @param clusterData
+ * @param parent
+ * @return
+ */
private boolean updateChildStatus(String appId, String id, Map<String, Group> groups,
Map<String, ClusterDataHolder> clusterData, ParentComponent parent) {
boolean groupActive = false;
@@ -210,12 +254,8 @@ public class StatusChecker {
}
return childFound;
} else {
- if (!groups.isEmpty()) {
- for (Group group : groups.values()) {
- return updateChildStatus(appId, id, group.getAliasToGroupMap(), group.getClusterDataMap(), group);
-
- }
- }
+ log.warn("There is no child found in the [group/cluster] " + id + " found in the " +
+ "[component]" + parent.getUniqueIdentifier());
}
return childFound;
}
[2/2] git commit: Merge branch '4.0.0-grouping' of
https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0-grouping
Posted by re...@apache.org.
Merge branch '4.0.0-grouping' of https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0-grouping
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d7940c64
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d7940c64
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d7940c64
Branch: refs/heads/4.0.0-grouping
Commit: d7940c6407900629e83b60fe863e3e96a72bb4ed
Parents: 34c141c c063ac5
Author: reka <rt...@gmail.com>
Authored: Mon Oct 13 11:49:06 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Mon Oct 13 11:49:06 2014 +0530
----------------------------------------------------------------------
.../application/parser/ParserUtils.java | 4 +-
.../CompositeApplicationParseTest.java | 209 +++++++++++++++++++
2 files changed, 211 insertions(+), 2 deletions(-)
----------------------------------------------------------------------