Browse Source

removes deprecated statics

pull/345/merge
Spencer Gibb 7 years ago
parent
commit
b16b77f1dc
No known key found for this signature in database
GPG Key ID: 7788A47380690861
  1. 31
      spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java
  2. 1
      spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java

31
spring-cloud-commons/src/main/java/org/springframework/cloud/commons/util/InetUtils.java

@ -43,21 +43,17 @@ public class InetUtils implements Closeable { @@ -43,21 +43,17 @@ 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) {
.newSingleThreadExecutor(r -> {
Thread thread = new Thread(r);
thread.setName(InetUtilsProperties.PREFIX);
thread.setDaemon(true);
return thread;
}
});
}
@ -184,31 +180,6 @@ public class InetUtils implements Closeable { @@ -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;

1
spring-cloud-commons/src/test/java/org/springframework/cloud/commons/util/InetUtilsTests.java

@ -53,7 +53,6 @@ public class InetUtilsTests { @@ -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

Loading…
Cancel
Save