directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r475246 - /directory/branches/mina/1.0/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
Date Wed, 15 Nov 2006 14:37:58 GMT
Author: jvermillard
Date: Wed Nov 15 06:37:57 2006
New Revision: 475246

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

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

Modified: directory/branches/mina/1.0/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.0/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java?view=diff&rev=475246&r1=475245&r2=475246
==============================================================================
--- directory/branches/mina/1.0/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
(original)
+++ directory/branches/mina/1.0/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
Wed Nov 15 06:37:57 2006
@@ -25,7 +25,6 @@
 
 import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.management.IoSessionStat;
 import org.apache.mina.management.StatCollector;
 
 
@@ -83,153 +82,49 @@
 
     public float getTotalByteReadThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.next();
-                total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                    .getByteReadThroughput();
-            }
-        }
-        return total;
+    	return collector.getBytesReadThroughput();
     }
 
 
     public float getTotalByteWrittenThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.next();
-                total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                    .getByteWrittenThroughput();
-            }
-        }
-        return total;
+    	return collector.getBytesWrittenThroughput();
     }
 
 
     public float getTotalMessageReadThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.next();
-                total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                    .getMessageReadThroughput();
-            }
-        }
-        return total;
+    	return collector.getMsgReadThroughput();
     }
 
 
     public float getTotalMessageWrittenThroughput()
     {
-        float total = 0;
-        for ( Iterator iter = service.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.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.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.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.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.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.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.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.getManagedServiceAddresses().iterator(); iter.hasNext();
)
-        {
-            SocketAddress element = ( SocketAddress ) iter.next();
-
-            for ( Iterator iter2 = service.getManagedSessions( element ).iterator(); iter2.hasNext();
)
-            {
-                IoSession session = ( IoSession ) iter2.next();
-                total += ( ( IoSessionStat ) session.getAttribute( StatCollector.KEY ) )
-                    .getMessageWrittenThroughput();
-                count++;
-            }
-        }
-        return total / count;
+        return collector.getMsgWrittenThroughput() / (float) collector.getSessionCount();
   
     }
 
 



Mime
View raw message