Github user ivmaykov commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/669#discussion_r226755285 --- Diff: zookeeper-common/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java --- @@ -68,18 +70,21 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket { private static final Logger LOG = LoggerFactory.getLogger(ClientCnxnSocketNetty.class); - ChannelFactory channelFactory = new NioClientSocketChannelFactory( - Executors.newCachedThreadPool(), Executors.newCachedThreadPool()); - Channel channel; - CountDownLatch firstConnect; - ChannelFuture connectFuture; - Lock connectLock = new ReentrantLock(); - AtomicBoolean disconnected = new AtomicBoolean(); - AtomicBoolean needSasl = new AtomicBoolean(); - Semaphore waitSasl = new Semaphore(0); + private final EventLoopGroup eventLoopGroup; + private Channel channel; + private CountDownLatch firstConnect; + private ChannelFuture connectFuture; + private final Lock connectLock = new ReentrantLock(); + private final AtomicBoolean disconnected = new AtomicBoolean(); + private final AtomicBoolean needSasl = new AtomicBoolean(); + private final Semaphore waitSasl = new Semaphore(0); + + private static final AtomicReference<ByteBufAllocator> TEST_ALLOCATOR = + new AtomicReference<>(null); ClientCnxnSocketNetty(ZKClientConfig clientConfig) throws IOException { this.clientConfig = clientConfig; + eventLoopGroup = new NioEventLoopGroup(0, Executors.newCachedThreadPool()); --- End diff -- I'd like to do it in a follow-up diff. I was thinking we default to NIO (since it works on all OSes), and have a config option to use Epoll instead.
---