public class NativeCacheManipulatingResolver extends NativeResolver
AdvancedHostResolver that provides native JVM lookup using NativeResolver
but also implements DNS cache manipulation functionality.
Important note: The Oracle JVM does not provide any public facility to manipulate the JVM's DNS cache. This class uses reflection to forcibly
manipulate the cache, which includes access to private class members that are not part of the published Java specification. As such, this
implementation is brittle and may break in a future Java release, or may not work on non-Oracle JVMs. If this implementation cannot
perform any of its operations due to a failure to find or set the relevant field using reflection, it will log a warning but will not
throw an exception. You are using this class at your own risk! JVM cache manipulation does not work on Windows -- this class will behave exactly
the same as NativeResolver on that platform.| Constructor and Description |
|---|
NativeCacheManipulatingResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearDNSCache()
Clears both the positive (successful DNS lookups) and negative (failed DNS lookups) cache.
|
void |
setNegativeDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
Sets the negative (failed DNS lookup) timeout when making DNS lookups.
|
void |
setPositiveDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
Sets the positive (successful DNS lookup) timeout when making DNS lookups.
|
resolveRemappedapplyRemapping, clearHostRemappings, getHostRemappings, getOriginalHostnames, remapHost, remapHosts, removeHostRemapping, resolveclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearHostRemappings, getHostRemappings, getOriginalHostnames, remapHost, remapHosts, removeHostRemappingresolvepublic void clearDNSCache()
AdvancedHostResolverclearDNSCache in interface AdvancedHostResolverclearDNSCache in class NativeResolverpublic void setPositiveDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
AdvancedHostResolversetPositiveDNSCacheTimeout in interface AdvancedHostResolversetPositiveDNSCacheTimeout in class NativeResolvertimeout - maximum lookup timetimeUnit - units of the timeout valuepublic void setNegativeDNSCacheTimeout(int timeout,
TimeUnit timeUnit)
AdvancedHostResolversetNegativeDNSCacheTimeout in interface AdvancedHostResolversetNegativeDNSCacheTimeout in class NativeResolvertimeout - maximum lookup timetimeUnit - units of the timeout valueCopyright © 2015. All Rights Reserved.