You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/01/09 06:16:15 UTC

[GitHub] david-streamlio commented on a change in pull request #3336: Added HTTP Support

david-streamlio commented on a change in pull request #3336: Added HTTP Support
URL: https://github.com/apache/pulsar/pull/3336#discussion_r246269122
 
 

 ##########
 File path: pulsar-io/netty/src/main/java/org/apache/pulsar/io/netty/server/NettyServer.java
 ##########
 @@ -108,6 +116,22 @@ private void runTcp() throws InterruptedException {
         channelFuture.channel().closeFuture().sync();
     }
 
+    private void runHttp() throws InterruptedException {
+        bossGroup = new NioEventLoopGroup(this.numberOfThreads);
+        workerGroup = new NioEventLoopGroup(this.numberOfThreads);
+
+        ServerBootstrap serverBootstrap = new ServerBootstrap();
+        serverBootstrap.group(bossGroup, workerGroup)
+                .channel(NioServerSocketChannel.class)
+                .childHandler(new NettyHttpChannelInitializer(new NettyHttpServerHandler(this.nettySource), null))
+                .option(ChannelOption.SO_BACKLOG, 1024)
+                .childOption(ChannelOption.SO_KEEPALIVE, true);
+
+        ChannelFuture channelFuture = serverBootstrap.bind(this.host, this.port).sync();
+        channelFuture.channel().closeFuture().sync();
+    }
+
 
 Review comment:
   Yes, I wasn't a fan of having duplicate code, so I will rework that piece a bit.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services