Package com.alibaba.dcm.internal
Class InetAddressCacheUtilForJdk9Plus
- java.lang.Object
-
- com.alibaba.dcm.internal.InetAddressCacheUtilForJdk9Plus
-
public class InetAddressCacheUtilForJdk9Plus extends Object
Util class to manipulate dns cache forJDK 9+.dns cache is
InetAddress.cache.- Since:
- 1.6.0
- Author:
- antfling (ding_zhengang at hithinksoft dot com), Jerry Lee (oldratlee at gmail dot com)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearInetAddressCache()static DnsCacheEntrygetInetAddressCache(String host)static DnsCachelistInetAddressCache()static voidremoveInetAddressCache(String host)static voidsetInetAddressCache(String host, String[] ips, long expireMillis)InetAddress.CachedAddresses
-
-
-
Method Detail
-
setInetAddressCache
public static void setInetAddressCache(String host, String[] ips, long expireMillis) throws UnknownHostException, IllegalAccessException, InstantiationException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException
InetAddress.CachedAddressesFor jdk9+,
- need not convert host to lowercase.
seeInetAddress.CachedAddresses#CachedAddresses. final long expiryTime; // time of expiry (in terms of System.nanoTime())
seeInetAddress.CachedAddresses#expiryTime.
- need not convert host to lowercase.
-
removeInetAddressCache
public static void removeInetAddressCache(String host) throws NoSuchFieldException, IllegalAccessException
-
getInetAddressCache
@Nullable public static DnsCacheEntry getInetAddressCache(String host) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException
-
listInetAddressCache
public static DnsCache listInetAddressCache() throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException
-
clearInetAddressCache
public static void clearInetAddressCache() throws NoSuchFieldException, IllegalAccessException
-
-