Code snippet optimization

This commit is contained in:
hongqiaowei
2021-10-09 10:59:19 +08:00
parent 3bdf053701
commit 1d9e508410

View File

@@ -63,8 +63,8 @@ public class NetworkUtils {
}
public static Set<String> getServerIps() {
try {
if (serverIps.isEmpty()) {
if (serverIps.isEmpty()) {
try {
String ip = System.getProperty(SERVER_IP);
if (StringUtils.isBlank(ip)) {
ip = System.getenv(SERVER_IP);
@@ -91,11 +91,11 @@ public class NetworkUtils {
serverIps.add(ip);
}
log.info("server ip: {}", serverIps);
} catch (SocketException | UnknownHostException e) {
throw new RuntimeException(e);
}
return serverIps;
} catch (SocketException | UnknownHostException e) {
throw new RuntimeException(e);
}
return serverIps;
}
public static int getServerId() {