Sumit Lakra
02/17/2022, 5:43 AMMayank
pinot.set.instance.id.to.hostname that defaults to false.Sumit Lakra
02/17/2022, 6:14 AMMayank
/**
* Get the hostname or IP address.
*
* @return The hostname if available, otherwise a dotted quad address. Returns null if neither can be determined.
*/
public static String getHostnameOrAddress() {
try {
return InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException ignored) {
try {
return getHostAddress();
} catch (Exception e) {
return null;
}
}
}Mayank
InetAddress.getLocalHost().getCanonicalHostName() throws an exception, then it will default to host addressSumit Lakra
02/17/2022, 6:24 AMSumit Lakra
02/17/2022, 6:28 AMSumit Lakra
02/17/2022, 6:29 AMMayank
Peter Pringle
02/17/2022, 10:15 AM