You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2006/11/21 13:54:09 UTC
svn commit: r477656 -
/mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java
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();
}