Updated Branches: refs/heads/master 01dcc513d -> 395636f1e
changing sliding window to mili seconds and some logs Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/395636f1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/395636f1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/395636f1 Branch: refs/heads/master Commit: 395636f1e21a4b52bb0d01115318eab3e8ca1a28 Parents: 01dcc51 Author: Lahiru Sandaruwan <[email protected]> Authored: Wed Jan 15 11:20:55 2014 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Wed Jan 15 11:20:55 2014 +0530 ---------------------------------------------------------------------- .../statistics/LoadBalancerStatisticsCollector.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/395636f1/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/statistics/LoadBalancerStatisticsCollector.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/statistics/LoadBalancerStatisticsCollector.java b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/statistics/LoadBalancerStatisticsCollector.java index cff081b..a133cf9 100644 --- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/statistics/LoadBalancerStatisticsCollector.java +++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/statistics/LoadBalancerStatisticsCollector.java @@ -57,8 +57,8 @@ public class LoadBalancerStatisticsCollector implements LoadBalancerStatisticsRe public int getInFlightRequestCountOfSlidingWindow(String clusterId) { //Clear the list before returning... - //Sliding window in seconds - int slidingWindow = 60;//TODO get this from a config + //Sliding window in Milliseconds + int slidingWindow = 60000;//TODO get this from a config if (inFlightRequestToDateListMap.containsKey(clusterId)) { Vector<Date> vector = inFlightRequestToDateListMap.get(clusterId); @@ -94,7 +94,7 @@ public class LoadBalancerStatisticsCollector implements LoadBalancerStatisticsRe inFlightRequestToDateListMap.get(clusterId).add(new Date()); } if (log.isDebugEnabled()) { - log.debug(String.format("In-flight request count updated: [cluster] %s ", clusterId)); + log.debug(String.format("In-flight request added to counting list: [cluster] %s ", clusterId)); } } @@ -113,10 +113,12 @@ public class LoadBalancerStatisticsCollector implements LoadBalancerStatisticsRe log.debug(String.format("In-flight list not available for cluster : [cluster] %s ", clusterId)); } } else { - inFlightRequestToDateListMap.remove(clusterId); - } - if (log.isDebugEnabled()) { - log.debug(String.format("In-flight request count updated: [cluster] %s ", clusterId)); + Vector<Date> vector = inFlightRequestToDateListMap.get(clusterId); + vector.remove(vector.size() - 1); + + if (log.isDebugEnabled()) { + log.debug(String.format("In-flight request removed from counting list: [cluster] %s ", clusterId)); + } } }
