From 016e00bf7a914c2db3d53128291a953bf3ea0fa8 Mon Sep 17 00:00:00 2001 From: Nikolay Fedorovskikh Date: Wed, 5 Jul 2017 23:29:34 +0500 Subject: [PATCH] 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. --- .../src/main/java/io/netty/channel/epoll/EpollEventLoop.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java index 909088fde4..2607615117 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java @@ -350,6 +350,8 @@ final class EpollEventLoop extends SingleThreadEventLoop { } catch (IOException ignore) { // ignore on close } + // Using the intermediate collection to prevent ConcurrentModificationException. + // In the `close()` method, the channel is deleted from `channels` map. Collection array = new ArrayList(channels.size()); for (AbstractEpollChannel channel: channels.values()) {