Package com.alibaba.dcm.internal
Class InetAddressCacheUtilForJdk8Minus
- java.lang.Object
-
- com.alibaba.dcm.internal.InetAddressCacheUtilForJdk8Minus
-
public class InetAddressCacheUtilForJdk8Minus extends Object
Util class to manipulate dns cache forJDK 8-.dns cache is
InetAddress.Cache#cacheinInetAddress#addressCache.Caution:
Manipulation onInetAddress#addressCacheMUST be guarded byInetAddress#addressCacheto avoid multithreading problem, you can see the implementation ofInetAddressto confirm this (See Also lists key code ofInetAddressrelated to this point).- Author:
- Jerry Lee (oldratlee at gmail dot com)
- See Also:
InetAddress,InetAddress#addressCache,InetAddress.CacheEntry,InetAddress#cacheInitIfNeeded(),InetAddress#cacheAddresses(String, InetAddress[], boolean)
-
-
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)Need convert host to lowercase, seeInetAddress#cacheAddresses(String, InetAddress[], boolean).
-
-
-
Method Detail
-
setInetAddressCache
public static void setInetAddressCache(String host, String[] ips, long expireMillis) throws UnknownHostException, IllegalAccessException, InstantiationException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException
Need convert host to lowercase, seeInetAddress#cacheAddresses(String, InetAddress[], boolean).
-
removeInetAddressCache
public static void removeInetAddressCache(String host) throws NoSuchFieldException, IllegalAccessException
-
getInetAddressCache
@Nullable public static DnsCacheEntry getInetAddressCache(String host) throws NoSuchFieldException, IllegalAccessException
-
listInetAddressCache
public static DnsCache listInetAddressCache() throws NoSuchFieldException, IllegalAccessException
-
clearInetAddressCache
public static void clearInetAddressCache() throws NoSuchFieldException, IllegalAccessException
-
-