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/12/12 14:04:36 UTC
[2/4] stratos git commit: fixing removal of group instance before
notifying the parent
fixing removal of group instance before notifying the parent
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e73995e1
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e73995e1
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e73995e1
Branch: refs/heads/4.1.0-test
Commit: e73995e1706e6e6b81cf255b1240742043c0d10a
Parents: 1512551
Author: reka <rt...@gmail.com>
Authored: Fri Dec 12 13:27:54 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Dec 12 18:34:19 2014 +0530
----------------------------------------------------------------------
.../autoscaler/applications/topic/ApplicationBuilder.java | 4 ++--
.../autoscaler/monitor/component/GroupMonitor.java | 8 +++-----
.../monitor/component/ParentComponentMonitor.java | 10 ++--------
3 files changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/e73995e1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
index 9a467b5..210ce7c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationBuilder.java
@@ -400,11 +400,11 @@ public class ApplicationBuilder {
networkPartitionContext.getPartitionCtxt(context.getPartitionId()).
removeActiveInstance(context);
}
-
monitor.removeInstance(instanceId);
+ group.removeInstance(instanceId);
monitor.setStatus(status, instanceId);
}
- group.removeInstance(instanceId);
+
ApplicationHolder.persistApplication(application);
ApplicationsEventPublisher.sendGroupInstanceTerminatedEvent(appId, groupId, instanceId);
http://git-wip-us.apache.org/repos/asf/stratos/blob/e73995e1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
index 2baba68..368fe0d 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/monitor/component/GroupMonitor.java
@@ -126,16 +126,14 @@ public class GroupMonitor extends ParentComponentMonitor implements Runnable {
public void setStatus(GroupStatus status, String instanceId) {
GroupInstance groupInstance = (GroupInstance) this.instanceIdToInstanceMap.get(instanceId);
if (groupInstance == null) {
- log.warn("The required group [instance] " + instanceId + " not found in the GroupMonitor");
+ if(status != GroupStatus.Terminated) {
+ log.warn("The required group [instance] " + instanceId + " not found in the GroupMonitor");
+ }
} else {
if (groupInstance.getStatus() != status) {
groupInstance.setStatus(status);
}
}
- /*if (status == GroupStatus.Inactive && !this.hasStartupDependents) {
- log.info("[Group] " + this.id + "is not notifying the parent, " +
- "since it is identified as the independent unit");
- } else {*/
// notify parent
log.info("[Group] " + this.id + "is notifying the [parent] " + this.parent.getId());
if (this.isGroupScalingEnabled()) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/e73995e1/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 f6096d9..2f749a3 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
@@ -296,19 +296,13 @@ public abstract class ParentComponentMonitor extends Monitor {
*/
protected void onChildInactiveEvent(String childId, final String instanceId) {
List<ApplicationChildContext> terminationList;
- Monitor monitor;
terminationList = this.startupDependencyTree.getTerminationDependencies(childId);
+
//Need to notify the parent about the status change from Active-->InActive
// TODO to make app also inaction if (this.parent != null) {
- Runnable monitoringRunnable = new Runnable() {
- @Override
- public void run() {
ServiceReferenceHolder.getInstance().getGroupStatusProcessorChain().
process(id, appId, instanceId);
- }
- };
- monitoringRunnable.run();
- //}
+
//TODO checking whether terminating them in reverse order,
// TODO if so can handle it in the parent event.