You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by jv...@apache.org on 2006/11/16 14:57:39 UTC

svn commit: r475739 - /directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java

Author: jvermillard
Date: Thu Nov 16 05:57:38 2006
New Revision: 475739

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

Modified:
    directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java

Modified: directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java
URL: http://svn.apache.org/viewvc/directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java?view=diff&rev=475739&r1=475738&r2=475739
==============================================================================
--- directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java (original)
+++ directory/branches/mina/1.0/core/src/main/java/org/apache/mina/management/StatCollector.java Thu Nov 16 05:57:38 2006
@@ -206,7 +206,9 @@
     	{
         	totalProcessedSessions += 1;
         	polledSessions.add( session );
-            session.setAttribute( KEY, new IoSessionStat() );
+        	IoSessionStat sessionStats = new IoSessionStat();
+        	sessionStats.lastPollingTime = System.currentTimeMillis();
+            session.setAttribute( KEY, sessionStats );
 		}
     }
 
@@ -302,11 +304,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(); )
                 {
@@ -317,19 +318,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();
                 }