Commit 6647cf9a authored by Dave Cridland's avatar Dave Cridland

Merge pull request #173 from tevans/OF-878

OF-878: NPE in MINAStatCollector
parents 07b73477 c5d906a3
......@@ -206,13 +206,14 @@ public class MINAStatCollector {
// add the bytes processed between last polling and session closing
// prevent non seen byte with non-connected protocols like HTTP and datagrams
IoSessionStat sessStat = ( IoSessionStat ) session.getAttribute( KEY );
session.removeAttribute( KEY );
IoSessionStat sessStat = ( IoSessionStat ) session.removeAttribute( KEY );
totalMsgWritten.addAndGet(session.getWrittenMessages() - sessStat.lastMessageWrite);
totalMsgRead.addAndGet(session.getReadMessages() - sessStat.lastMessageRead);
totalBytesWritten.addAndGet(session.getWrittenBytes() - sessStat.lastByteWrite);
totalBytesRead.addAndGet(session.getReadBytes() - sessStat.lastByteRead);
if (sessStat != null) {
totalMsgWritten.addAndGet(session.getWrittenMessages() - sessStat.lastMessageWrite);
totalMsgRead.addAndGet(session.getReadMessages() - sessStat.lastMessageRead);
totalBytesWritten.addAndGet(session.getWrittenBytes() - sessStat.lastByteWrite);
totalBytesRead.addAndGet(session.getReadBytes() - sessStat.lastByteRead);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment