[jboss-cvs] JBossAS SVN: r77331 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 21 18:09:26 EDT 2008


Author: pferraro
Date: 2008-08-21 18:09:25 -0400 (Thu, 21 Aug 2008)
New Revision: 77331

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/BusyConnectorsLoadMetric.java
Log:
Express load as ratio of busy to max threads.

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/BusyConnectorsLoadMetric.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/BusyConnectorsLoadMetric.java	2008-08-21 21:31:20 UTC (rev 77330)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/load/metric/impl/BusyConnectorsLoadMetric.java	2008-08-21 22:09:25 UTC (rev 77331)
@@ -35,6 +35,7 @@
 public class BusyConnectorsLoadMetric extends AbstractLoadMetric
 {
    private static final String CURRENT_THREADS_BUSY = "currentThreadsBusy";
+   private static final String MAX_THREADS = "maxThreads";
    
    private final ThreadPoolLoadMetricSource source;
    
@@ -51,7 +52,7 @@
     */
    public double getLoad() throws JMException
    {
-      int busy = 0;
+      double busy = 0;
       
       List<Integer> results = this.source.getAttributes(CURRENT_THREADS_BUSY, Integer.class);
       
@@ -59,7 +60,16 @@
       {
          busy += result.intValue();
       }
+
+      double max = 0;
       
-      return busy;
+      results = this.source.getAttributes(MAX_THREADS, Integer.class);
+
+      for (Integer result: results)
+      {
+         max += result.intValue();
+      }
+      
+      return busy / max;
    }
 }




More information about the jboss-cvs-commits mailing list