Charles Connell created HBASE-29688:
---------------------------------------
Summary: Use VarHandle instead of Unsafe where possible in 3.x
Key: HBASE-29688
URL: https://issues.apache.org/jira/browse/HBASE-29688
Project: HBase
Issue Type: Improvement
Reporter: Charles Connell
Assignee: Charles Connell
Java offers {{VarHandle}} to facilitate fast access to memory, in place of the
{{Unsafe#get*}} and {{Unsafe#put*}} methods. It can be used as almost a drop-in
replacement, and the performance is similar. {{VarHandle}} was introduced in
Java 9. HBase 2.x supports Java 8, so we cannot use {{VarHandle}} in 2.x
releases, but we can prepare to use it in 3.x releases. This will eliminate
most uses of {{Unsafe}} in HBase. Remaining uses of {{Unsafe}} are for copying
memory regions. There is an alternative available for that, {{MemorySegment}},
that is available in Java 22 and higher, but we'll tackle that much later.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)