[
https://issues.apache.org/jira/browse/HADOOP-12690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087609#comment-15087609
]
Junping Du commented on HADOOP-12690:
-------------------------------------
Thanks [~drankye] for review and comments!
bq. Maybe we could cache the unsafe instance in the new utility, so callers
won't do the cache thing themselves?
Are you suggesting we have a singleton instance cached in utility class? I am
concern that it could have problems if caller from some objects loaded from
different Classloaders. I don't quite clear how unsafe internal works as a
private API but some of its APIs like: objectFieldOffset, arrayBaseOffset, etc.
could be ClassLoader specific? I would prefer to play more safely even it get
called "unsafe". :)
bq. Better to have some comment to explain about the new approach, because
without looking at the discussion in the JIRAs, some one may be not easy to
catch why it goes like that.
Sounds good. Will add more comments in next patch.
bq. I guess you added TestFastByteComparision by the way?
I am using TestFastByteComparisions (not TestFastByteComparision) to show it
tests the class FastByteComparisions. Any issue here I could miss?
> Consolidate access of sun.misc.Unsafe
> --------------------------------------
>
> Key: HADOOP-12690
> URL: https://issues.apache.org/jira/browse/HADOOP-12690
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Junping Du
> Assignee: Junping Du
> Attachments: HADOOP-12690.patch
>
>
> Per discussion in Hadoop-12630
> (https://issues.apache.org/jira/browse/HADOOP-12630?focusedCommentId=15082142&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15082142),
> we found the access of sun.misc.Unsafe could be problematic for some JVMs in
> other platforms. Also, hints from other comments, it is better to consolidate
> it as a helper/utility method to shared with several places
> (FastByteComparisons, NativeIO, ShortCircuitShm).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)