Clarify the appointment of the intermediate collection

Motivation:

An intermediate list is creating in the `EpollEventLoop#closeAll` to prevent ConcurrentModificationException. But this is not the obvious purpose has no comment.

Modifications:

Add comment to clarify the appointment of the intermediate collection.

Result:

More clear code.
This commit is contained in:
Nikolay Fedorovskikh 2017-07-05 23:29:34 +05:00 committed by Scott Mitchell
parent d3581b575e
commit 016e00bf7a

View File

@ -350,6 +350,8 @@ final class EpollEventLoop extends SingleThreadEventLoop {
} catch (IOException ignore) { } catch (IOException ignore) {
// ignore on close // ignore on close
} }
// Using the intermediate collection to prevent ConcurrentModificationException.
// In the `close()` method, the channel is deleted from `channels` map.
Collection<AbstractEpollChannel> array = new ArrayList<AbstractEpollChannel>(channels.size()); Collection<AbstractEpollChannel> array = new ArrayList<AbstractEpollChannel>(channels.size());
for (AbstractEpollChannel channel: channels.values()) { for (AbstractEpollChannel channel: channels.values()) {