Package com.wavefront.agent.channel
Class CachingHostnameLookupResolver
- java.lang.Object
-
- com.wavefront.agent.channel.CachingHostnameLookupResolver
-
- All Implemented Interfaces:
Function<InetAddress,String>
public class CachingHostnameLookupResolver extends Object implements Function<InetAddress,String>
ConvertInetAddress
toString
, either by performing reverse DNS lookups (cached, as the name implies), or by converting IP addresses into their string representation.- Author:
- [email protected]
-
-
Constructor Summary
Constructors Constructor Description CachingHostnameLookupResolver()
Create a new instance with all default settings: - rDNS lookup enabled - no cache size metric - max 5000 elements in the cache - 5 minutes refresh TTL - 1 hour expiry TTLCachingHostnameLookupResolver(boolean disableRdnsLookup, com.yammer.metrics.core.MetricName metricName)
Create a new instance with default cache settings: - max 5000 elements in the cache - 5 minutes refresh TTL - 1 hour expiry TTLCachingHostnameLookupResolver(boolean disableRdnsLookup, com.yammer.metrics.core.MetricName metricName, int maxSize, Duration cacheRefreshTtl, Duration cacheExpiryTtl)
Create a new instance with specific cache settings:
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apply(InetAddress addr)
static InetAddress
getRemoteAddress(io.netty.channel.ChannelHandlerContext ctx)
-
-
-
Constructor Detail
-
CachingHostnameLookupResolver
public CachingHostnameLookupResolver()
Create a new instance with all default settings: - rDNS lookup enabled - no cache size metric - max 5000 elements in the cache - 5 minutes refresh TTL - 1 hour expiry TTL
-
CachingHostnameLookupResolver
public CachingHostnameLookupResolver(boolean disableRdnsLookup, @Nullable com.yammer.metrics.core.MetricName metricName)
Create a new instance with default cache settings: - max 5000 elements in the cache - 5 minutes refresh TTL - 1 hour expiry TTL- Parameters:
disableRdnsLookup
- if true, simply return a string representation of the IP addressmetricName
- if specified, use this metric for the cache size gauge.
-
CachingHostnameLookupResolver
public CachingHostnameLookupResolver(boolean disableRdnsLookup, @Nullable com.yammer.metrics.core.MetricName metricName, int maxSize, Duration cacheRefreshTtl, Duration cacheExpiryTtl)
Create a new instance with specific cache settings:- Parameters:
disableRdnsLookup
- if true, simply return a string representation of the IP address.metricName
- if specified, use this metric for the cache size gauge.maxSize
- max cache size.cacheRefreshTtl
- trigger cache refresh after specified durationcacheExpiryTtl
- expire items after specified duration
-
-
Method Detail
-
apply
public String apply(InetAddress addr)
- Specified by:
apply
in interfaceFunction<InetAddress,String>
-
getRemoteAddress
public static InetAddress getRemoteAddress(io.netty.channel.ChannelHandlerContext ctx)
-
-