jdeppe-pivotal commented on a change in pull request #5064:
URL: https://github.com/apache/geode/pull/5064#discussion_r421510687



##########
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);
 
     // Bind and start to accept incoming connections.
-    ChannelFuture f = b.bind(new InetSocketAddress(getBindAddress(), 
serverPort)).sync();
+    ChannelFuture channelFuture =
+        serverBootstrap.bind(
+            new InetSocketAddress(
+                getBindAddress(),
+                serverPort))
+            .sync();
+
     if (logger.infoEnabled()) {
-      String logMessage = "GeodeRedisServer started {" + getBindAddress() + 
":" + serverPort
-          + "}, Selector threads: " + numSelectorThreads;
+      String logMessage =
+          "GeodeRedisServer started {"
+              + getBindAddress()
+              + ":" + serverPort
+              + "}, Selector threads: "
+              + numSelectorThreads;
+

Review comment:
       4 lines have expanded to 15. I find this harder to now quickly parse and 
see where subsequent new logic starts.




----------------------------------------------------------------
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


Reply via email to