You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/01/04 21:53:45 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #12032: Migrade Druid HttpClient from Netty 3 to 4

clintropolis commented on a change in pull request #12032:
URL: https://github.com/apache/druid/pull/12032#discussion_r769206105



##########
File path: core/src/main/java/org/apache/druid/java/util/http/client/HttpClientInit.java
##########
@@ -53,39 +48,13 @@ public static HttpClient createClient(HttpClientConfig config, Lifecycle lifecyc
     try {
       // We need to use the full constructor in order to set a ThreadNameDeterminer. The other parameters are taken
       // from the defaults in HashedWheelTimer's other constructors.

Review comment:
       these comments seem no longer relevant

##########
File path: core/src/main/java/org/apache/druid/java/util/http/client/NettyHttpClient.java
##########
@@ -355,30 +355,31 @@ public void channelDisconnected(ChannelHandlerContext context, ChannelStateEvent
           private void removeHandlers()
           {
             if (readTimeout > 0) {
-              channel.getPipeline().remove(READ_TIMEOUT_HANDLER_NAME);
+              channel.pipeline().remove(READ_TIMEOUT_HANDLER_NAME);
             }
-            channel.getPipeline().remove(LAST_HANDLER_NAME);
+            channel.pipeline().remove(LAST_HANDLER_NAME);
           }
         }
     );
 
-    channel.write(httpRequest).addListener(
-        new ChannelFutureListener()
-        {
-          @Override
-          public void operationComplete(ChannelFuture future)
-          {
-            if (!future.isSuccess()) {
-              channel.close();
-              channelResourceContainer.returnResource();
-              if (!retVal.isDone()) {
-                retVal.setException(
-                    new ChannelException(
-                        StringUtils.format("[%s] Failed to write request to channel", requestDesc),
-                        future.getCause()
-                    )
-                );
-              }
+    channel.write(httpRequest);
+    if (request.hasContent()) {
+      channel.write(new DefaultHttpContent(request.getContent()));
+    }
+    channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT).addListener(

Review comment:
       the 'flush' change was the one that stuck out to me in https://netty.io/wiki/new-and-noteworthy-in-4.0.html, looks like we got them all afaict :+1:




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

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org