[
https://issues.apache.org/jira/browse/HADOOP-7115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13492733#comment-13492733
]
Todd Lipcon commented on HADOOP-7115:
-------------------------------------
- why is cacheTimeout volatile? You're already synchronizing on the class
inside {{ensureInitialized}}.
- instead of {{ensureInitialized}}, why not initialize the configuration in the
existing static {...} block?
- instead of using ints for {{USER}} and {{GROUP}}, how about an enum like this:
{code}
enum IdCache {
USERNAME,
GROUP;
ConcurrentHashMap<Integer, CachedName> cache =
new ConcurrentHashMap<Integer, CachedName>();
}
...
private static String getName(IdCache cache, int id) {
CachedName cachedName = cache.cache.get(id);
...
}
{code}
this way you get typesafety, and you can just stringify the {{IdCache}}
instance to get a printable name
Otherwise looks good to me
> Add a cache for getpwuid_r and getpwgid_r calls
> -----------------------------------------------
>
> Key: HADOOP-7115
> URL: https://issues.apache.org/jira/browse/HADOOP-7115
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.22.0, 2.0.2-alpha, 0.23.4
> Reporter: Arun C Murthy
> Assignee: Alejandro Abdelnur
> Fix For: 0.22.1, 2.0.3-alpha
>
> Attachments: h-7115.1.patch, hadoop-7115-0.22.patch,
> hadoop-7115-0.22.patch, HADOOP-7115.patch
>
>
> As discussed in HADOOP-6978, a cache helps a lot.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira