stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [4/5] stratos git commit: Add group monitor as scheduled excutor
Date Sat, 13 Dec 2014 12:42:34 GMT
Add group monitor as scheduled excutor


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

Branch: refs/heads/4.1.0-test
Commit: d61306adb1c630e3f3eb2b3b3822b6c02fea0466
Parents: 689471f
Author: gayan <gayan@puppet.gayan.org>
Authored: Fri Dec 12 19:33:24 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Sat Dec 13 18:04:04 2014 +0530

----------------------------------------------------------------------
 .../component/ParentComponentMonitor.java       | 44 +++++++++-----------
 1 file changed, 19 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d61306ad/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 3ed04ca..37455cc 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
@@ -187,12 +187,9 @@ public abstract class ParentComponentMonitor extends Monitor {
         for (ApplicationChildContext context : applicationContexts) {
             if (context instanceof GroupChildContext) {
                 GroupMonitor groupMonitor = (GroupMonitor) this.aliasToActiveMonitorsMap.
-                        get(context.getId());
-                groupMonitor.createInstanceOnDemand(instanceId);
-            } else if (context instanceof ClusterChildContext) {
-                VMClusterMonitor clusterMonitor = (VMClusterMonitor) this.aliasToActiveMonitorsMap.
-                        get(context.getId());
-                clusterMonitor.createInstanceOnDemand(instanceId);
+                                                        get(context.getId());
+            } else if(context instanceof ClusterChildContext) {
+
             }
         }
 
@@ -491,8 +488,8 @@ public abstract class ParentComponentMonitor extends Monitor {
                     TopologyManager.acquireReadLockForCluster(monitor1.getServiceId(),
                             monitor1.getClusterId());
                     try {
-                        if (((ClusterInstance)monitor1.getInstance(instanceId)).getStatus()
-                                                    == ClusterStatus.Active) {
+                        if (((ClusterInstance) monitor1.getInstance(instanceId)).getStatus()
+                                == ClusterStatus.Active) {
                             parentsActive = true;
                         }
                     } finally {
@@ -508,7 +505,7 @@ public abstract class ParentComponentMonitor extends Monitor {
 
     // move to inactive monitors list to use in the Terminated event
     protected synchronized void markInstanceAsInactive(String childId, String instanceId)
{
-        if (!this.inactiveInstancesMap.containsKey(childId)) {
+        if (this.inactiveInstancesMap.containsKey(childId)) {
             this.inactiveInstancesMap.get(childId).add(instanceId);
         } else {
             List<String> instanceIds = new ArrayList<String>();
@@ -522,7 +519,7 @@ public abstract class ParentComponentMonitor extends Monitor {
         if (this.inactiveInstancesMap.containsKey(childId) &&
                 this.inactiveInstancesMap.get(childId).contains(instanceId)) {
             this.inactiveInstancesMap.get(childId).remove(instanceId);
-            if(this.inactiveInstancesMap.get(childId).isEmpty()) {
+            if (this.inactiveInstancesMap.get(childId).isEmpty()) {
                 this.inactiveInstancesMap.remove(childId);
             }
         }
@@ -533,7 +530,7 @@ public abstract class ParentComponentMonitor extends Monitor {
         if (this.terminatingInstancesMap.containsKey(childId) &&
                 this.terminatingInstancesMap.get(childId).contains(instanceId)) {
             this.terminatingInstancesMap.get(childId).remove(instanceId);
-            if(this.terminatingInstancesMap.get(childId).isEmpty()) {
+            if (this.terminatingInstancesMap.get(childId).isEmpty()) {
                 this.terminatingInstancesMap.remove(childId);
             }
         }
@@ -541,22 +538,19 @@ public abstract class ParentComponentMonitor extends Monitor {
 
     // move to inactive monitors list to use in the Terminated event
     protected synchronized void markInstanceAsTerminating(String childId, String instanceId)
{
-        if (!this.terminatingInstancesMap.containsKey(childId)) {
-            if (this.inactiveInstancesMap.containsKey(childId) &&
-                    this.inactiveInstancesMap.get(childId).contains(instanceId)) {
-                this.inactiveInstancesMap.get(childId).remove(instanceId);
-                this.terminatingInstancesMap.get(childId).add(instanceId);
-            } else {
-                if (this.inactiveInstancesMap.containsKey(childId) &&
-                        this.inactiveInstancesMap.get(childId).contains(instanceId)) {
-                    this.inactiveInstancesMap.get(childId).remove(instanceId);
-                }
-                List<String> instanceIds = new ArrayList<String>();
-                instanceIds.add(instanceId);
-                this.terminatingInstancesMap.put(childId, instanceIds);
-            }
+        if (this.inactiveInstancesMap.containsKey(childId) &&
+                this.inactiveInstancesMap.get(childId).contains(instanceId)) {
+            this.inactiveInstancesMap.get(childId).remove(instanceId);
+        }
+        if (this.terminatingInstancesMap.containsKey(childId)) {
+            this.terminatingInstancesMap.get(childId).add(instanceId);
+        } else {
+            List<String> instanceIds = new ArrayList<String>();
+            instanceIds.add(instanceId);
+            this.terminatingInstancesMap.put(childId, instanceIds);
         }
     }
+    }
 
     protected synchronized void startMonitor(ParentComponentMonitor parent,
                                              ApplicationChildContext context, List<String>
instanceId) {


Mime
View raw message