lhotari commented on code in PR #19327:
URL: https://github.com/apache/pulsar/pull/19327#discussion_r1087632048


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarChannelInitializer.java:
##########
@@ -209,5 +209,33 @@ CompletableFuture<Channel> initSocks5IfConfig(Channel ch) {
 
         return initSocks5Future;
     }
+
+    CompletableFuture<Channel> initializeClientCnx(Channel ch,
+                                                   InetSocketAddress 
logicalAddress,
+                                                   InetSocketAddress 
resolvedPhysicalAddress) {
+        CompletableFuture<Channel> initFuture = new CompletableFuture<>();
+        ch.eventLoop().execute(() -> {
+            final ClientCnx cnx = (ClientCnx) ch.pipeline().get("handler");
+
+            if (cnx == null) {
+                initFuture
+                        .completeExceptionally(new 
IllegalStateException("Missing ClientCnx. This should not happen."));
+            }

Review Comment:
   I wonder if this should be removed?
   
   Instead of doing the CompletableFuture logic manually, one possibility would 
be to rely on Netty for that. I think that the benefit would be that all 
exceptions would be caught.
   
   ```
   NettyFutureUtil.toCompletableFuture(ch.eventLoop().submit(() -> { .... }, 
ch));
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to