mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r477656 - /mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java
Date Tue, 21 Nov 2006 12:54:09 GMT
Author: jvermillard
Date: Tue Nov 21 04:54:09 2006
New Revision: 477656

URL: http://svn.apache.org/viewvc?view=rev&rev=477656
Log:
DIRMINA-299 continued,
fixing the closed session buggy numbers

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java?view=diff&rev=477656&r1=477655&r2=477656
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java Tue Nov 21
04:54:09 2006
@@ -195,7 +195,10 @@
     	{
     	    totalProcessedSessions += 1;
     	    polledSessions.add( session );
-    	    session.setAttribute( KEY, new IoSessionStat() );
+
+    	    IoSessionStat sessionStats = new IoSessionStat();
+    	    sessionStats.lastPollingTime = System.currentTimeMillis();
+    	    session.setAttribute( KEY, sessionStats );
     	}
     }
 
@@ -291,10 +294,10 @@
                 }
                 
                 
-                msgWrittenThroughput = 0f;
-                msgReadThroughput = 0f;
-                bytesWrittenThroughput = 0f;
-                bytesReadThroughput = 0f;
+                float tmpMsgWrittenThroughput = 0f;
+                float tmpMsgReadThroughput = 0f;
+                float tmpBytesWrittenThroughput = 0f;
+                float tmpBytesReadThroughput = 0f;
                 
                 for ( Iterator iter = polledSessions.iterator(); iter.hasNext(); )
                 {
@@ -305,19 +308,24 @@
 
                     sessStat.byteReadThroughput = ( session.getReadBytes() - sessStat.lastByteRead
)
                         / ( pollingInterval / 1000f );
-                    bytesReadThroughput += sessStat.byteReadThroughput;
+                    tmpBytesReadThroughput += sessStat.byteReadThroughput;
                     
                     sessStat.byteWrittenThroughput = ( session.getWrittenBytes() - sessStat.lastByteWrite
)
                         / ( pollingInterval / 1000f );
-                    bytesWrittenThroughput += sessStat.byteWrittenThroughput;
+                    tmpBytesWrittenThroughput += sessStat.byteWrittenThroughput;
 
                     sessStat.messageReadThroughput = ( session.getReadMessages() - sessStat.lastMessageRead
)
                         / ( pollingInterval / 1000f );
-                    msgReadThroughput += sessStat.messageReadThroughput;
+                    tmpMsgReadThroughput += sessStat.messageReadThroughput;
                     
                     sessStat.messageWrittenThroughput = ( session.getWrittenMessages() -
sessStat.lastMessageWrite )
                         / ( pollingInterval / 1000f );
-                    msgWrittenThroughput += sessStat.messageWrittenThroughput;
+                    tmpMsgWrittenThroughput += sessStat.messageWrittenThroughput;
+                    
+                    msgWrittenThroughput = tmpMsgWrittenThroughput;
+                    msgReadThroughput = tmpMsgReadThroughput;
+                    bytesWrittenThroughput = tmpBytesWrittenThroughput;
+                    bytesReadThroughput = tmpMsgWrittenThroughput;
                     
                     sessStat.lastPollingTime = System.currentTimeMillis();
                 }



Mime
View raw message