ptupitsyn commented on code in PR #3297:
URL: https://github.com/apache/ignite-3/pull/3297#discussion_r1507660435
##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java:
##########
@@ -313,32 +314,41 @@ protected void initChannel(Channel ch) {
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
configuration.connectTimeout());
int port = configuration.port();
+ String address = configuration.listenAddress();
+
+ ChannelFuture channelFuture = address.isEmpty() ? bootstrap.bind(port)
: bootstrap.bind(address, port);
- bootstrap.bind(port).addListener((ChannelFutureListener) bindFut -> {
+ channelFuture.addListener((ChannelFutureListener) bindFut -> {
if (bindFut.isSuccess()) {
if (LOG.isInfoEnabled()) {
- LOG.info("Thin client connector endpoint started
successfully [port={}]", port);
+ LOG.info(
+ "Thin client connector endpoint started
successfully [{}]",
+ (address.isEmpty() ? "" : "address=" + address +
",") + "port=" + port);
}
result.complete(bindFut.channel());
- return;
- }
-
- if (bindFut.cause() instanceof BindException) {
+ } else if (bindFut.cause() instanceof BindException) {
+ //TODO IGNITE-21614
result.completeExceptionally(
new IgniteException(
PORT_IN_USE_ERR,
"Cannot start thin client connector endpoint.
Port " + port + " is in use.",
bindFut.cause())
);
- return;
+ } else if (bindFut.cause() instanceof UnresolvedAddressException) {
+ result.completeExceptionally(
+ new IgniteException(
+ ADDRESS_UNRESOLVED,
+ "Failed to start thin connector endpoint,
unresolved socket address \"" + address + "\""
Review Comment:
`bindFut.cause()` is lost, let's pass it as cause to the new exception.
--
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]