From 31211487e9e27e030646d070f43cc31f3f12f72e Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 25 Jun 2014 20:17:54 +0200 Subject: [PATCH] Use IntObjectMap to replace Map in EpollEventLoop. Motivation: We need to map from ints to AbstractEpollChannel in EpollEventLoop but there is no need for box to Integer. Modification: Replace Map with IntObjectMap. Result: No more auto-boxing needed. --- .../java/io/netty/channel/epoll/EpollEventLoop.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 4b52804e9b..037415d5d7 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 @@ -19,6 +19,8 @@ import io.netty.channel.EventLoop; import io.netty.channel.EventLoopGroup; import io.netty.channel.SingleThreadEventLoop; import io.netty.channel.epoll.AbstractEpollChannel.AbstractEpollUnsafe; +import io.netty.util.collection.IntObjectHashMap; +import io.netty.util.collection.IntObjectMap; import io.netty.util.internal.PlatformDependent; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; @@ -26,8 +28,6 @@ import io.netty.util.internal.logging.InternalLoggerFactory; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; -import java.util.Map; import java.util.Queue; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; @@ -50,7 +50,7 @@ final class EpollEventLoop extends SingleThreadEventLoop { private final int epollFd; private final int eventFd; - private final Map ids = new HashMap(); + private final IntObjectMap ids = new IntObjectHashMap(); private final long[] events; private int id; @@ -292,8 +292,8 @@ final class EpollEventLoop extends SingleThreadEventLoop { Native.epollWait(epollFd, events, 0); Collection channels = new ArrayList(ids.size()); - for (AbstractEpollChannel ch: ids.values()) { - channels.add(ch); + for (IntObjectMap.Entry entry: ids.entries()) { + channels.add(entry.value()); } for (AbstractEpollChannel ch: channels) {