[
https://issues.apache.org/jira/browse/HADOOP-12690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15088496#comment-15088496
]
Kai Zheng commented on HADOOP-12690:
------------------------------------
Thanks Junping for the update!
bq. Are you suggesting we have a singleton instance cached in utility class?
Yeah. {{Unsafe}} is from the core part of JRE and we're likely to be OK about
the class loading in a Java process. The new utility as old code does, is
purely trying to obtain (not create) the existing singleton instance. Instead
of maintaining multiple references to the instance, what I suggested is to just
use one, maintained in the new utility.
bq. I would prefer to play more safely even it get called "unsafe".
It's fine to me. I understand you want to avoid other behaviour changes. :)
bq. Any issue here I could miss?
Ah no. It's great you added the test by the way.
A very minor in the latest patch, a whitespace in the new utility class.
> 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-v2.1.patch, HADOOP-12690-v2.patch,
> 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)