Added log information about inaccessible nodes within tcp communication
@@ -40,6 +40,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.StringJoiner;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentLinkedDeque;
@@ -3042,10 +3043,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
if (time > CONNECTION_ESTABLISH_THRESHOLD_MS) {
if (log.isInfoEnabled())
- log.info("TCP client created [client=" + client + ", duration=" + time + "ms]");
+ log.info("TCP client created [client=" + clientString(client, node) + ", duration=" + time + "ms]");
}
else if (log.isDebugEnabled())
- log.debug("TCP client created [client=" + client + ", duration=" + time + "ms]");
+ log.debug("TCP client created [client=" + clientString(client, node) + ", duration=" + time + "ms]");
return client;
}
@@ -3054,6 +3055,30 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
}
}
+ /**
+ * Returns the string representation of client with protection from null client value. If the client if null,
+ * string representation is built from cluster node.
+ *
+ * @param client communication client
+ * @param node cluster node to which the client tried to establish a connection
+ * @return string representation of client
+ * @throws IgniteCheckedException if failed
+ */
+ private String clientString(GridCommunicationClient client, ClusterNode node) throws IgniteCheckedException {
+ if (client == null) {
+ assert node != null;
+
+ StringJoiner joiner = new StringJoiner(", ");
+
+ for (InetSocketAddress addr : nodeAddresses(node))
+ joiner.add(addr.toString());
+
+ return "null, node addrs=[" + joiner.toString() + "]";
+ }
+ else
+ return client.toString();
+ }
+
/**
* @param node Node.
* @param port Port.
