directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r475256 - /directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
Date Wed, 15 Nov 2006 15:05:19 GMT
Author: jvermillard
Date: Wed Nov 15 07:05:18 2006
New Revision: 475256

URL: http://svn.apache.org/viewvc?view=rev&rev=475256
Log:
using new StatCollector resume field for speedup service stat display

Modified:
    directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java

Modified: directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java?view=diff&rev=475256&r1=475255&r2=475256
==============================================================================
--- directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
(original)
+++ directory/trunks/mina/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
Wed Nov 15 07:05:18 2006
@@ -98,118 +98,53 @@
 
     }
 
-
     public float getTotalByteReadThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getByteReadThroughput();
-        }
-        return total;
+    	return collector.getBytesReadThroughput();
     }
 
 
     public float getTotalByteWrittenThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getByteWrittenThroughput();
-        }
-        return total;
+    	return collector.getBytesWrittenThroughput();
     }
 
 
     public float getTotalMessageReadThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getMessageReadThroughput();
-        }
-        return total;
+    	return collector.getMsgReadThroughput();
     }
 
 
     public float getTotalMessageWrittenThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getMessageWrittenThroughput();
-        }
-        return total;
+    	return collector.getMsgWrittenThroughput();
     }
 
 
     public float getAverageByteReadThroughput()
     {
-        float total = 0;
-        int count = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getByteReadThroughput();
-            count++;
-        }
-        return total / count;
+        return collector.getBytesReadThroughput() / (float) collector.getSessionCount();
     }
 
 
     public float getAverageByteWrittenThroughput()
     {
-        float total = 0;
-        int count = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getByteWrittenThroughput();
-            count++;
-        }
-        return total / count;
+        return collector.getBytesWrittenThroughput() / (float) collector.getSessionCount();
   
     }
 
 
     public float getAverageMessageReadThroughput()
     {
-        float total = 0;
-        int count = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getMessageReadThroughput();
-            count++;
-        }
-        return total / count;
+        return collector.getMsgReadThroughput() / (float) collector.getSessionCount();
     }
 
 
     public float getAverageMessageWrittenThroughput()
     {
-        float total = 0;
-        int count = 0;
-        for ( Iterator iter = service.getManagedSessions().iterator(); iter.hasNext(); )
-        {
-            IoSession session = ( IoSession ) iter.next();
-            total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                .getMessageWrittenThroughput();
-            count++;
-        }
-        return total / count;
+        return collector.getMsgWrittenThroughput() / (float) collector.getSessionCount();
   
     }
-
+    
 
     public void closeAllSessions()
     {



Mime
View raw message