xinglin commented on code in PR #6183:
URL: https://github.com/apache/hadoop/pull/6183#discussion_r1392037472
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java:
##########
@@ -1982,4 +1983,28 @@ public static void addTransferRateMetric(final
DataNodeMetrics metrics, final lo
LOG.warn("Unexpected value for data transfer bytes={} duration={}",
read, duration);
}
}
+
+ /**
+ * Retrieve InetSocketAddress set by ip port string array.
+ * @param nodesHostPort ip port string array.
+ * @return HostSet of InetSocketAddress.
+ */
+ public static HostSet convertHostSet(String[] nodesHostPort) {
+ HostSet retSet = new HostSet();
+ for (String hostPort : nodesHostPort) {
+ try {
+ URI uri = new URI("dummy", hostPort, null, null, null);
+ int port = uri.getPort() == -1 ? 0 : uri.getPort();
Review Comment:
is it appropriate here? It seems 0 is a valid port but -1 should indicate
port is not set?
> A valid port value is between 0 and 65535. A port number of zero will let
the system pick up an ephemeral port in a bind operation.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]