[#2363] Correctly null out SelectionKey[] when selectAgain

Motivation:

The prefix fix of #2363 did not correctly handle the case when selectAgain is true and so missed to null out entries.

Modifications:

Move the i++ from end of loop to beginning of loop

Result:

Entries in the array will be null out so allow to have these GC'ed once the Channel close
This commit is contained in:
fu.jian 2016-01-08 14:11:58 +08:00 committed by Norman Maurer
parent 1bee71fb1c
commit 0c733e1425

View File

@ -475,11 +475,11 @@ public final class NioEventLoop extends SingleThreadEventLoop {
// null out entries in the array to allow to have it GC'ed once the Channel close
// See https://github.com/netty/netty/issues/2363
for (;;) {
i++;
if (selectedKeys[i] == null) {
break;
}
selectedKeys[i] = null;
i++;
}
selectAgain();