[
https://issues.apache.org/jira/browse/HBASE-26773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498398#comment-17498398
]
Duo Zhang commented on HBASE-26773:
-----------------------------------
The result of the first try is not very good:
1. In ClassSize, we need to use ARRAY_OBJECT_INDEX_SCALE and
ARRAY_BYTE_INDEX_SCALE, which are not exposed by netty's PlatformDependent.
2. In Bytes and ByteBufferUtils, we uses the raw Unsafe instead of
UnsafeAccess. I think this is for performance as we will calculate the offset
on the fly, and then use it as the final offset directly. Use UnsafeAccess will
introduce an extra calculation so may impact performance.
So now, I prefer we provide a hbase-thirdparty-unsafe module in
hbase-thirdparty, to expose what we want with Unsafe, and compile it with jdk8,
to keep compatibility.
Let me change the title.
> Use Netty PlatformDependent to remove the direct references of Unsafe
> ---------------------------------------------------------------------
>
> Key: HBASE-26773
> URL: https://issues.apache.org/jira/browse/HBASE-26773
> Project: HBase
> Issue Type: Improvement
> Components: compatibility, util
> Reporter: Duo Zhang
> Assignee: Duo Zhang
> Priority: Major
>
> For java 9+, sun.misc.Unsafe is in the module jdk.unsupported. When compiling
> with java 11 --release 8, these symbols will not be exported and lead to
> compile errors.
> There is a jdk issue
> https://bugs.openjdk.java.net/browse/JDK-8214165
> But seems the jdk team does not want to fix it. So if we want to move up to
> java 11 but still keep the java 8 compatibility, a possible choice is to
> remove the direct reference of sun.misc.Unsafe so at compile time there will
> be no problem, and at runtime we export the jdk.unsupported so there will be
> no problem too.
> For more details, please see the discussion of this thread on the dev mailing
> list.
> https://lists.apache.org/thread/w5lrxkhswlonj09xf9hcwgvck3nsjdfx
--
This message was sent by Atlassian Jira
(v8.20.1#820001)