Madan Jampani

Better netty transport initialization

...@@ -18,7 +18,6 @@ import io.netty.channel.ChannelOption; ...@@ -18,7 +18,6 @@ import io.netty.channel.ChannelOption;
18 import io.netty.channel.EventLoopGroup; 18 import io.netty.channel.EventLoopGroup;
19 import io.netty.channel.ServerChannel; 19 import io.netty.channel.ServerChannel;
20 import io.netty.channel.SimpleChannelInboundHandler; 20 import io.netty.channel.SimpleChannelInboundHandler;
21 -import io.netty.channel.epoll.Epoll;
22 import io.netty.channel.epoll.EpollEventLoopGroup; 21 import io.netty.channel.epoll.EpollEventLoopGroup;
23 import io.netty.channel.epoll.EpollServerSocketChannel; 22 import io.netty.channel.epoll.EpollServerSocketChannel;
24 import io.netty.channel.epoll.EpollSocketChannel; 23 import io.netty.channel.epoll.EpollSocketChannel;
...@@ -64,18 +63,13 @@ public class NettyMessagingService implements MessagingService { ...@@ -64,18 +63,13 @@ public class NettyMessagingService implements MessagingService {
64 // try Epoll first and if that does work, use nio. 63 // try Epoll first and if that does work, use nio.
65 // TODO: make this configurable. 64 // TODO: make this configurable.
66 try { 65 try {
67 - if (Epoll.isAvailable()) { 66 + clientGroup = new EpollEventLoopGroup();
68 - clientGroup = new EpollEventLoopGroup(); 67 + serverGroup = new EpollEventLoopGroup();
69 - serverGroup = new EpollEventLoopGroup(); 68 + serverChannelClass = EpollServerSocketChannel.class;
70 - serverChannelClass = EpollServerSocketChannel.class; 69 + clientChannelClass = EpollSocketChannel.class;
71 - clientChannelClass = EpollSocketChannel.class; 70 + return;
72 - return;
73 - } else {
74 - log.info("Netty epoll support is not available. Proceeding with nio.");
75 - }
76 -
77 } catch (Throwable t) { 71 } catch (Throwable t) {
78 - log.warn("Failed to initialize epoll sockets. Proceeding with nio.", t); 72 + log.warn("Failed to initialize native (epoll) transport. Proceeding with nio.", t);
79 } 73 }
80 clientGroup = new NioEventLoopGroup(); 74 clientGroup = new NioEventLoopGroup();
81 serverGroup = new NioEventLoopGroup(); 75 serverGroup = new NioEventLoopGroup();
......