removes deprecated statics

This commit is contained in:
Spencer Gibb
2018-03-21 12:25:04 -04:00
parent f94c75f0df
commit b16b77f1dc
2 changed files with 7 additions and 37 deletions

View File

@@ -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;

View File

@@ -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