slfan1989 commented on code in PR #7527: URL: https://github.com/apache/hadoop/pull/7527#discussion_r2021996002
########## hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java: ########## @@ -586,17 +594,62 @@ InetAddress getByName(String hostname) throws UnknownHostException { return hostResolver.getByName(hostname); } } - + interface HostResolver { - InetAddress getByName(String host) throws UnknownHostException; + InetAddress getByName(String host) throws UnknownHostException; + } + + static abstract class CacheableHostResolver implements HostResolver { + private volatile LoadingCache<String, InetAddress> cache; + + CacheableHostResolver(long expiryIntervalSecs) { + if (expiryIntervalSecs > 0) { + cache = CacheBuilder.newBuilder() + .expireAfterWrite(expiryIntervalSecs, TimeUnit.SECONDS) Review Comment: Thanks for the explanation! this makes sense to me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org