Package com.alibaba.dcm.internal
Class InetAddressCacheUtilCommons
- java.lang.Object
-
- com.alibaba.dcm.internal.InetAddressCacheUtilCommons
-
public class InetAddressCacheUtilCommons extends Object
Util class to manipulate dns cache.- Since:
- 1.6.0
- Author:
- Jerry Lee (oldratlee at gmail dot com)
-
-
Field Summary
Fields Modifier and Type Field Description static longNEVER_EXPIRATIONWe never really have "never".
-
Constructor Summary
Constructors Constructor Description InetAddressCacheUtilCommons()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetDnsCachePolicy()static intgetDnsNegativeCachePolicy()static voidsetDnsCachePolicy(int cacheSeconds)Set JVM DNS cache policystatic voidsetDnsNegativeCachePolicy(int negativeCacheSeconds)Set JVM DNS negative cache policy
-
-
-
Field Detail
-
NEVER_EXPIRATION
public static final long NEVER_EXPIRATION
We never really have "never".Long.MAX_VALUE(~9e18)nanoseconds is ~292 years.Long.MAX_VALUE / 1e9 / 3600 / 24 / 365 ~= 292.47.- See Also:
- Constant Field Values
-
-
Method Detail
-
setDnsCachePolicy
public static void setDnsCachePolicy(int cacheSeconds) throws NoSuchFieldException, IllegalAccessExceptionSet JVM DNS cache policy- Parameters:
cacheSeconds- set default dns cache time. Special input case:-
-1means never expired.(In effect, all negative value) -
0never cached.
-
- Throws:
NoSuchFieldExceptionIllegalAccessException- See Also:
InetAddressCachePolicy,InetAddressCachePolicy.cachePolicy
-
getDnsCachePolicy
public static int getDnsCachePolicy()
-
setDnsNegativeCachePolicy
public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) throws NoSuchFieldException, IllegalAccessExceptionSet JVM DNS negative cache policy- Parameters:
negativeCacheSeconds- set default dns cache time. Special input case:-
-1means never expired.(In effect, all negative value) -
0never cached.
-
- Throws:
NoSuchFieldExceptionIllegalAccessException- See Also:
InetAddressCachePolicy,InetAddressCachePolicy.negativeCachePolicy
-
getDnsNegativeCachePolicy
public static int getDnsNegativeCachePolicy()
-
-