jdeppe-pivotal commented on a change in pull request #5064: URL: https://github.com/apache/geode/pull/5064#discussion_r421508746
########## File path: geode-redis/src/main/java/org/apache/geode/redis/GeodeRedisServer.java ########## @@ -596,61 +596,121 @@ public Thread newThread(Runnable r) { bossGroup = null; workerGroup = null; + Class<? extends ServerChannel> socketClass; if (singleThreadPerConnection) { socketClass = - startRedisServiceSingleThreadPerConnection(selectorThreadFactory, workerThreadFactory); + startRedisServiceSingleThreadPerConnection( + selectorThreadFactory, + workerThreadFactory); } else { - bossGroup = new NioEventLoopGroup(numSelectorThreads, selectorThreadFactory); - workerGroup = new NioEventLoopGroup(numWorkerThreads, workerThreadFactory); + bossGroup = + new NioEventLoopGroup(numSelectorThreads, selectorThreadFactory); + workerGroup = + new NioEventLoopGroup(numWorkerThreads, workerThreadFactory); + socketClass = NioServerSocketChannel.class; } - InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem(); - String pwd = system.getConfig().getRedisPassword(); - final byte[] pwdB = Coder.stringToBytes(pwd); - ServerBootstrap b = new ServerBootstrap(); - b.group(bossGroup, workerGroup).channel(socketClass) - .childHandler(new ChannelInitializer<SocketChannel>() { - @Override - public void initChannel(SocketChannel ch) { - if (logger.fineEnabled()) { - logger.fine("GeodeRedisServer-Connection established with " + ch.remoteAddress()); - } - ChannelPipeline p = ch.pipeline(); - addSSLIfEnabled(ch, p); - p.addLast(ByteToCommandDecoder.class.getSimpleName(), new ByteToCommandDecoder()); - p.addLast(ExecutionHandlerContext.class.getSimpleName(), - new ExecutionHandlerContext(ch, cache, regionCache, GeodeRedisServer.this, pwdB, - keyRegistrar, pubSub, hashLockService)); - } - }).option(ChannelOption.SO_REUSEADDR, true).option(ChannelOption.SO_RCVBUF, getBufferSize()) + InternalDistributedSystem system = + (InternalDistributedSystem) cache.getDistributedSystem(); + + String pwd = + system.getConfig().getRedisPassword(); + + final byte[] passwordAsByteArray = + Coder.stringToBytes(pwd); + + ServerBootstrap serverBootstrap = new ServerBootstrap(); + + serverBootstrap + .group(bossGroup, workerGroup) + .channel(socketClass) + .childHandler(getChildHandler(passwordAsByteArray)) + .option(ChannelOption.SO_REUSEADDR, true) + .option(ChannelOption.SO_RCVBUF, getBufferSize()) .childOption(ChannelOption.SO_KEEPALIVE, true) - .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, GeodeRedisServer.connectTimeoutMillis) - .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); + .childOption( + ChannelOption.CONNECT_TIMEOUT_MILLIS, + GeodeRedisServer.connectTimeoutMillis) + .childOption( + ChannelOption.ALLOCATOR, + PooledByteBufAllocator.DEFAULT); Review comment: I like this change! Definitely worth line-separating chained method calls like this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org