You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2013/12/12 07:37:10 UTC

git commit: fixing min check of LB Cluster monitor

Updated Branches:
  refs/heads/master b0c1351da -> 2c39018fd


fixing min check of LB Cluster monitor


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

Branch: refs/heads/master
Commit: 2c39018fdaf317606476286221f49b1e5d5fb20c
Parents: b0c1351
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Dec 12 12:06:26 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Dec 12 12:06:38 2013 +0530

----------------------------------------------------------------------
 .../stratos/autoscaler/LbClusterMonitor.java    | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2c39018f/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java
index 9e3b4a5..131dfe6 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/LbClusterMonitor.java
@@ -141,15 +141,30 @@ public class LbClusterMonitor implements Runnable{
     }
     
     private void monitor() {
-//        if(clusterCtxt != null ) {
-            //TODO make this concurrent
+        // TODO make this concurrent
         for (NetworkPartitionContext networkPartitionContext : networkPartitionCtxts.values()) {
 
-                minCheckKnowledgeSession.setGlobal("clusterId", clusterId);
-                log.info("partition " + networkPartitionContext.getId());
-                minCheckFactHandle = AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession
-                        , minCheckFactHandle, networkPartitionContext);
+            // minimum check per partition
+            for (PartitionContext partitionContext : networkPartitionContext.getPartitionCtxts()
+                                                                            .values()) {
 
+                if (partitionContext != null) {
+                    minCheckKnowledgeSession.setGlobal("clusterId", clusterId);
+
+                    if (log.isDebugEnabled()) {
+                        log.debug(String.format("Running minimum check for partition %s ",
+                                                partitionContext.getPartitionId()));
+                    }
+
+                    minCheckFactHandle =
+                                         AutoscalerRuleEvaluator.evaluateMinCheck(minCheckKnowledgeSession,
+                                                                                  minCheckFactHandle,
+                                                                                  partitionContext);
+                    // start only in the first partition context
+                    break;
+                }
+
+            }
 
         }
     }