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,14 +206,15 @@ public class MINAStatCollector { ...@@ -206,14 +206,15 @@ public class MINAStatCollector {
// add the bytes processed between last polling and session closing // add the bytes processed between last polling and session closing
// prevent non seen byte with non-connected protocols like HTTP and datagrams // prevent non seen byte with non-connected protocols like HTTP and datagrams
IoSessionStat sessStat = ( IoSessionStat ) session.getAttribute( KEY ); IoSessionStat sessStat = ( IoSessionStat ) session.removeAttribute( KEY );
session.removeAttribute( KEY );
if (sessStat != null) {
totalMsgWritten.addAndGet(session.getWrittenMessages() - sessStat.lastMessageWrite); totalMsgWritten.addAndGet(session.getWrittenMessages() - sessStat.lastMessageWrite);
totalMsgRead.addAndGet(session.getReadMessages() - sessStat.lastMessageRead); totalMsgRead.addAndGet(session.getReadMessages() - sessStat.lastMessageRead);
totalBytesWritten.addAndGet(session.getWrittenBytes() - sessStat.lastByteWrite); totalBytesWritten.addAndGet(session.getWrittenBytes() - sessStat.lastByteWrite);
totalBytesRead.addAndGet(session.getReadBytes() - sessStat.lastByteRead); 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