[
https://issues.apache.org/jira/browse/HADOOP-10306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13890482#comment-13890482
]
Hiroshi Ikeda commented on HADOOP-10306:
----------------------------------------
For example Records.newRecords() (in YARN project) always dynamically creates
an implementation class name and eventually calls this logic. And then VM
always tries to drop its class cache as soon as possible, and ironically this
overhead may become larger than just calling Class.forName() especially in
well optimized VM.
> Unnecessary weak reference map to cache classes in Configuration
> ----------------------------------------------------------------
>
> Key: HADOOP-10306
> URL: https://issues.apache.org/jira/browse/HADOOP-10306
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Hiroshi Ikeda
> Priority: Trivial
>
> In Configuration.getClassByNameOrNull():
> {code}
> synchronized (CACHE_CLASSES) {
> map = CACHE_CLASSES.get(classLoader);
> if (map == null) {
> map = Collections.synchronizedMap(
> new WeakHashMap<String, WeakReference<Class<?>>>());
> CACHE_CLASSES.put(classLoader, map);
> }
> }
> {code}
> Change "new WeaHashMap<String, ...>()" to "new HashMap<String, ...>" or
> something. Otherwise, even while the class is actively used, this may drop
> its class cache.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)