apurtell commented on a change in pull request #4164:
URL: https://github.com/apache/hbase/pull/4164#discussion_r822010905



##########
File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/nio/SingleByteBuff.java
##########
@@ -65,7 +62,7 @@ public SingleByteBuff(Recycler recycler, ByteBuffer buf) {
       this.unsafeOffset = UnsafeAccess.BYTE_ARRAY_BASE_OFFSET + 
buf.arrayOffset();
       this.unsafeRef = buf.array();
     } else {
-      this.unsafeOffset = ((DirectBuffer) buf).address();
+      this.unsafeOffset = UnsafeAccess.directBufferAddress(buf);

Review comment:
       Should we move all of UnsafeAccess into HBasePlatformDependent? 

##########
File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java
##########
@@ -186,13 +186,19 @@ long sizeOfByteArray(int len) {
       private byte a;
     }
 
+    private static final int ARRAY_OBJECT_INDEX_SCALE =
+      HBasePlatformDependent.arrayIndexScale(Object[].class);
+
+    private static final int ARRAY_BYTE_INDEX_SCALE =
+      HBasePlatformDependent.arrayIndexScale(byte[].class);
+
     public UnsafeLayout() {
     }
 
     @Override
     int headerSize() {
       try {
-        return (int) UnsafeAccess.theUnsafe.objectFieldOffset(
+        return (int) HBasePlatformDependent.objectFieldOffset(

Review comment:
       This is platform dependent so should be moved into 
HBasePlatformDependent. Perhaps all of ClassSize should go up in there but at 
least these methods involving object layout concerns can be replaced with 
external static helpers in the thirdparty module.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to