isapego commented on code in PR #3077:
URL: https://github.com/apache/ignite-3/pull/3077#discussion_r1462971153


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java:
##########
@@ -319,32 +313,35 @@ protected void initChannel(Channel ch) {
                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 
configuration.connectTimeout());
 
         int port = configuration.port();
-        Channel ch = null;
-
-        ChannelFuture bindRes = bootstrap.bind(port).await();
-
-        if (bindRes.isSuccess()) {
-            ch = bindRes.channel();
-        } else if (!(bindRes.cause() instanceof BindException)) {
-            throw new IgniteException(
-                    INTERNAL_ERR,
-                    "Failed to start thin client connector endpoint: " + 
bindRes.cause().getMessage(),
-                    bindRes.cause());
-        }
-
-        if (ch == null) {
-            String msg = "Cannot start thin client connector endpoint. Port " 
+ port + " is in use.";
-
-            LOG.debug(msg);
-
-            throw new IgniteException(ErrorGroups.Network.PORT_IN_USE_ERR, 
msg);
-        }
-
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Thin client protocol started successfully [port={}]", 
port);
-        }
 
-        return ch.closeFuture();
+        bootstrap.bind(port).addListener((ChannelFutureListener) bindFut -> {
+            if (bindFut.isSuccess()) {
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("Thin client protocol started successfully 
[port={}]", port);

Review Comment:
   Sounds a little weird, does not it?



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java:
##########
@@ -319,32 +313,35 @@ protected void initChannel(Channel ch) {
                 .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 
configuration.connectTimeout());
 
         int port = configuration.port();
-        Channel ch = null;
-
-        ChannelFuture bindRes = bootstrap.bind(port).await();
-
-        if (bindRes.isSuccess()) {
-            ch = bindRes.channel();
-        } else if (!(bindRes.cause() instanceof BindException)) {
-            throw new IgniteException(
-                    INTERNAL_ERR,
-                    "Failed to start thin client connector endpoint: " + 
bindRes.cause().getMessage(),
-                    bindRes.cause());
-        }
-
-        if (ch == null) {
-            String msg = "Cannot start thin client connector endpoint. Port " 
+ port + " is in use.";
-
-            LOG.debug(msg);
-
-            throw new IgniteException(ErrorGroups.Network.PORT_IN_USE_ERR, 
msg);
-        }
-
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Thin client protocol started successfully [port={}]", 
port);
-        }
 
-        return ch.closeFuture();
+        bootstrap.bind(port).addListener((ChannelFutureListener) bindFut -> {
+            if (bindFut.isSuccess()) {
+                if (LOG.isInfoEnabled()) {
+                    LOG.info("Thin client protocol started successfully 
[port={}]", port);
+                }
+
+                result.complete(bindFut.channel());
+                return;
+            }
+
+            if (bindFut.cause() instanceof BindException) {
+                result.completeExceptionally(
+                        new IgniteException(
+                                PORT_IN_USE_ERR,
+                                "Cannot start thin client connector endpoint. 
Port " + port + " is in use.",

Review Comment:
   Here we use `connector endpoint`, not `protocol`, which sounds better to me.



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