You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2013/12/11 06:09:31 UTC
git commit: Added topology manager read lock and debug log to trace
the in-flight request count published in load balancer extension api
Updated Branches:
refs/heads/master 9b9115ac3 -> cd1510802
Added topology manager read lock and debug log to trace the in-flight request count published in load balancer extension api
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/cd151080
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/cd151080
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/cd151080
Branch: refs/heads/master
Commit: cd151080237b6549b7f862edc3bb06fb18f4fd57
Parents: 9b9115a
Author: Imesh Gunaratne <im...@apache.org>
Authored: Wed Dec 11 10:39:21 2013 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Wed Dec 11 10:39:21 2013 +0530
----------------------------------------------------------------------
...oadBalancerInFlightRequestCountNotifier.java | 25 +++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/cd151080/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerInFlightRequestCountNotifier.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerInFlightRequestCountNotifier.java b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerInFlightRequestCountNotifier.java
index 730bf00..f1f4da9 100644
--- a/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerInFlightRequestCountNotifier.java
+++ b/components/org.apache.stratos.load.balancer.extension.api/src/main/java/org/apache/stratos/load/balancer/extension/api/LoadBalancerInFlightRequestCountNotifier.java
@@ -59,15 +59,28 @@ public class LoadBalancerInFlightRequestCountNotifier implements Runnable {
}
if (statsPublisher.isEnabled()) {
- Collection<String> partitionIds;
- for (Service service : TopologyManager.getTopology().getServices()) {
- for (Cluster cluster : service.getClusters()) {
- partitionIds = cluster.findPartitionIds();
- for(String partitionId : partitionIds) {
- statsPublisher.publish(cluster.getClusterId(), partitionId, statsReader.getInFlightRequestCount(cluster.getClusterId(), partitionId));
+ try {
+ TopologyManager.acquireReadLock();
+ Collection<String> partitionIds;
+ int requestCount;
+ for (Service service : TopologyManager.getTopology().getServices()) {
+ for (Cluster cluster : service.getClusters()) {
+ partitionIds = cluster.findPartitionIds();
+ for(String partitionId : partitionIds) {
+ // Publish in-flight request count of each cluster partition
+ requestCount = statsReader.getInFlightRequestCount(cluster.getClusterId(), partitionId);
+ statsPublisher.publish(cluster.getClusterId(), partitionId, requestCount);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("In-flight request count published to cep: [cluster-id] %s [partition] %s [value] %d",
+ cluster.getClusterId(), partitionId, requestCount));
+ }
+ }
}
}
}
+ finally {
+ TopologyManager.releaseReadLock();
+ }
} else if (log.isWarnEnabled()) {
log.warn("CEP statistics publisher is disabled");
}