diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java index 93daeb62..ea386833 100644 --- a/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java +++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java @@ -43,22 +43,18 @@ public class InetUtils implements Closeable { // TODO: maybe shutdown the thread pool if it isn't being used? private final ExecutorService executorService; private final InetUtilsProperties properties; - private static final InetUtils instance = new InetUtils(new InetUtilsProperties()); - + private final Log log = LogFactory.getLog(InetUtils.class); public InetUtils(final InetUtilsProperties properties) { this.properties = properties; this.executorService = Executors - .newSingleThreadExecutor(new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread thread = new Thread(r); - thread.setName(InetUtilsProperties.PREFIX); - thread.setDaemon(true); - return thread; - } - }); + .newSingleThreadExecutor(r -> { + Thread thread = new Thread(r); + thread.setName(InetUtilsProperties.PREFIX); + thread.setDaemon(true); + return thread; + }); } @Override @@ -184,31 +180,6 @@ public class InetUtils implements Closeable { return hostInfo; } - /** - * Find the first non-loopback host info. If there were errors return a host info with - * 'localhost' and '127.0.0.1' for hostname and ipAddress respectively. - * - * @deprecated use the non-static findFirstNonLoopbackHostInfo() instead - */ - @Deprecated - public static HostInfo getFirstNonLoopbackHostInfo() { - return instance.findFirstNonLoopbackHostInfo(); - } - - /** - * Convert an internet address to a HostInfo. - * - * @deprecated use the non-static convertAddress() instead - */ - @Deprecated - public static HostInfo convert(final InetAddress address) { - return instance.convertAddress(address); - } - - public static int getIpAddressAsInt(String host) { - return new HostInfo(host).getIpAddressAsInt(); - } - public static class HostInfo { public boolean override; private String ipAddress; diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java index abcbe727..74f10a50 100644 --- a/spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java +++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java @@ -53,7 +53,6 @@ public class InetUtilsTests { try (InetUtils utils = new InetUtils(new InetUtilsProperties())) { assertNotNull(utils.convertAddress(InetAddress.getByName("localhost"))); } - assertNotNull(InetUtils.convert(InetAddress.getByName("localhost"))); } @Test