sumitagrawl commented on code in PR #4325:
URL: https://github.com/apache/ozone/pull/4325#discussion_r1133189078
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java:
##########
@@ -790,4 +791,28 @@ public static String format(List<ServiceInfo> nodes, int
port,
return sb.toString();
}
}
+
+ /**
+ * @param omHost
+ * @param omPort
+ * If the authority in the URI is not one of the service ID's,
+ * it is treated as a hostname. Check if this hostname can be resolved
+ * and if it's reachable.
+ */
+ public static void resolveOmHost(String omHost, int omPort) {
+ InetSocketAddress omHostAddress = NetUtils.createSocketAddr(omHost,
omPort);
+ if (omHostAddress.isUnresolved()) {
+ throw new IllegalArgumentException(
+ "Cannot resolve OM host " + omHost + " in the URI",
+ new UnknownHostException());
+ }
+ try {
+ if (!omHostAddress.getAddress().isReachable(5000)) {
+ throw new IllegalArgumentException(
+ "OM host " + omHost + " unreachable in the URI");
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
Review Comment:
We should not encapsulate IOException to RuntimeException, caller is
configured to throw IOException. Other issue in communication, we can have
error log also
--
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]