gosonzhang commented on a change in pull request #97:
URL: https://github.com/apache/incubator-tubemq/pull/97#discussion_r431195383
##########
File path:
tubemq-core/src/main/java/org/apache/tubemq/corebase/utils/AddressUtils.java
##########
@@ -34,31 +40,29 @@ public static synchronized String getLocalAddress() throws
Exception {
return localIPAddress;
}
- public static boolean validLocalIp(String currLocalHost) throws Exception {
+ public static boolean validLocalIp(String currLocalHost) {
if (TStringUtils.isNotEmpty(localIPAddress)
&& localIPAddress.equals(currLocalHost)) {
return true;
}
- Enumeration<NetworkInterface> allInterface =
NetworkInterface.getNetworkInterfaces();
- if (allInterface == null) {
- throw new Exception("Get NetworkInterfaces is null");
- }
+
+ Enumeration<NetworkInterface> allInterface = listNetworkInterface();
+
return checkValidIp(allInterface, currLocalHost);
}
- private static boolean checkValidIp(Enumeration<NetworkInterface>
allInterface,
- String currLocalHost) throws Exception
{
- String localIp = null;
+ private static boolean checkValidIp(Enumeration<NetworkInterface>
allInterface, String currLocalHost) {
Review comment:
ok!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]