You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/02/26 17:19:43 UTC
[GitHub] [hbase-thirdparty] Apache9 opened a new pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Apache9 opened a new pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78
…se-thirdparty to remove the direct references of Unsafe in our main code base
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache-HBase commented on pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#issuecomment-1055160884
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 1m 8s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +0 :ok: | spotbugs | 0m 0s | spotbugs executables are not available. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +1 :green_heart: | mvninstall | 0m 25s | master passed |
| +1 :green_heart: | compile | 0m 12s | master passed |
| +1 :green_heart: | checkstyle | 0m 26s | master passed |
| +1 :green_heart: | javadoc | 0m 5s | master passed |
| -0 :warning: | patch | 0m 35s | Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary. |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 5s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 0m 30s | the patch passed |
| +1 :green_heart: | compile | 0m 19s | the patch passed |
| -1 :x: | javac | 0m 6s | hbase-unsafe generated 4 new + 0 unchanged - 0 fixed = 4 total (was 0) |
| -1 :x: | javac | 0m 13s | root generated 4 new + 21 unchanged - 0 fixed = 25 total (was 21) |
| +1 :green_heart: | checkstyle | 0m 28s | the patch passed |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 1s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 0m 10s | the patch passed |
||| _ Other Tests _ |
| +1 :green_heart: | unit | 0m 6s | hbase-unsafe in the patch passed. |
| +1 :green_heart: | unit | 0m 33s | root in the patch passed. |
| +1 :green_heart: | asflicense | 0m 9s | The patch does not generate ASF License warnings. |
| | | 4m 45s | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/3/artifact/yetus-precommit-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase-thirdparty/pull/78 |
| Optional Tests | dupname asflicense javac javadoc unit xml compile spotbugs findbugs checkstyle |
| uname | Linux 33914005158d 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 GNU/Linux |
| Build tool | maven |
| git revision | master / 3ecf75e |
| Default Java | Oracle Corporation-1.8.0_282-b08 |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/3/artifact/yetus-precommit-check/output/diff-compile-javac-hbase-unsafe.txt |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/3/artifact/yetus-precommit-check/output/diff-compile-javac-root.txt |
| Test Results | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/3/testReport/ |
| Max. process+thread count | 387 (vs. ulimit of 1000) |
| modules | C: hbase-unsafe . U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/3/console |
| versions | git=2.20.1 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820709632
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
Review comment:
It will cause compile error, as there is a PrivilegedExceptionAction...
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820711163
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+ @Override
+ public Boolean run() {
+ return checkAvailable();
+ }
+ });
+ UNALIGNED = checkUnaligned();
+ }
+
+ private static boolean checkAvailable() {
+ try {
+ Class<?> clazz = Class.forName(CLASS_NAME);
+ Field f = clazz.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Object theUnsafe = f.get(null);
+ if (theUnsafe == null) {
+ LOG.warn("Could not get static instance from sun.misc.Unsafe");
+ return false;
+ }
+ // Check for availability of all methods used by UnsafeAccess
+ Method m;
+ try {
+ m = clazz.getDeclaredMethod("arrayBaseOffset", Class.class);
+ if (m == null) {
Review comment:
I just copied this piece of code from the hbase main repo, without any changes. Maybe it is used to be compatible with some strange JDK implementations?
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] apurtell commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
apurtell commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r816187315
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafe0}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
Review comment:
This is a bit of a joke, but would be fine too for real...
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache-HBase commented on pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#issuecomment-1053263929
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 1m 6s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +0 :ok: | spotbugs | 0m 0s | spotbugs executables are not available. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +1 :green_heart: | mvninstall | 0m 45s | master passed |
| +1 :green_heart: | compile | 0m 12s | master passed |
| +1 :green_heart: | checkstyle | 0m 29s | master passed |
| +1 :green_heart: | javadoc | 0m 6s | master passed |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 6s | Maven dependency ordering for patch |
| +1 :green_heart: | mvninstall | 0m 30s | the patch passed |
| +1 :green_heart: | compile | 0m 19s | the patch passed |
| -1 :x: | javac | 0m 6s | hbase-unsafe generated 4 new + 0 unchanged - 0 fixed = 4 total (was 0) |
| -1 :x: | javac | 0m 12s | root generated 4 new + 21 unchanged - 0 fixed = 25 total (was 21) |
| +1 :green_heart: | checkstyle | 0m 28s | the patch passed |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 1s | The patch has no ill-formed XML file. |
| +1 :green_heart: | javadoc | 0m 10s | the patch passed |
||| _ Other Tests _ |
| +1 :green_heart: | unit | 0m 6s | hbase-unsafe in the patch passed. |
| +1 :green_heart: | unit | 0m 33s | root in the patch passed. |
| +1 :green_heart: | asflicense | 0m 10s | The patch does not generate ASF License warnings. |
| | | 5m 11s | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/2/artifact/yetus-precommit-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase-thirdparty/pull/78 |
| Optional Tests | dupname asflicense javac javadoc unit xml compile spotbugs findbugs checkstyle |
| uname | Linux ce6fb1579894 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 GNU/Linux |
| Build tool | maven |
| git revision | master / 3ecf75e |
| Default Java | Oracle Corporation-1.8.0_282-b08 |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/2/artifact/yetus-precommit-check/output/diff-compile-javac-hbase-unsafe.txt |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/2/artifact/yetus-precommit-check/output/diff-compile-javac-root.txt |
| Test Results | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/2/testReport/ |
| Max. process+thread count | 388 (vs. ulimit of 1000) |
| modules | C: hbase-unsafe . U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/2/console |
| versions | git=2.20.1 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] apurtell commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
apurtell commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r816184999
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafe0}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
Review comment:
Want to call this PlatformDependent :-) ?
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe0.java
##########
@@ -0,0 +1,414 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.misc.Unsafe;
+
+/**
+ * Delegate all the method in sun.misc.Unsafe.
+ */
+@SuppressWarnings("restriction")
+final class HBaseUnsafe0 {
Review comment:
This naming is unusual for our code base. We usually do things like HBaseUnsafe -> HBaseUnsafeImpl, or HBaseUnsafe -> HBaseUnsafeInternal. The '0' suffix is efficient but the more typical constructions are better for comprehension.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#issuecomment-1053267053
The javac warnings are expected. We do use sun.misc.Unsafe in the package...
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r816377271
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe0.java
##########
@@ -0,0 +1,414 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import sun.misc.Unsafe;
+
+/**
+ * Delegate all the method in sun.misc.Unsafe.
+ */
+@SuppressWarnings("restriction")
+final class HBaseUnsafe0 {
Review comment:
I prefer the internal one.
Let me update the patch.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] ndimiduk commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820720521
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+ @Override
+ public Boolean run() {
+ return checkAvailable();
+ }
+ });
+ UNALIGNED = checkUnaligned();
+ }
+
+ private static boolean checkAvailable() {
+ try {
+ Class<?> clazz = Class.forName(CLASS_NAME);
+ Field f = clazz.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Object theUnsafe = f.get(null);
+ if (theUnsafe == null) {
+ LOG.warn("Could not get static instance from sun.misc.Unsafe");
+ return false;
+ }
+ // Check for availability of all methods used by UnsafeAccess
+ Method m;
+ try {
+ m = clazz.getDeclaredMethod("arrayBaseOffset", Class.class);
+ if (m == null) {
Review comment:
Hmm good point, this class implementation could be JDK dependent.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] ndimiduk commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820720238
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
Review comment:
_nod_
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] ndimiduk commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820875646
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+ @Override
+ public Boolean run() {
+ return checkAvailable();
+ }
+ });
+ UNALIGNED = checkUnaligned();
+ }
+
+ private static boolean checkAvailable() {
+ try {
+ Class<?> clazz = Class.forName(CLASS_NAME);
+ Field f = clazz.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Object theUnsafe = f.get(null);
+ if (theUnsafe == null) {
+ LOG.warn("Could not get static instance from sun.misc.Unsafe");
+ return false;
+ }
+ // Check for availability of all methods used by UnsafeAccess
+ Method m;
+ try {
+ m = clazz.getDeclaredMethod("arrayBaseOffset", Class.class);
+ if (m == null) {
Review comment:
Agreed it's not a big deal. It might be confusing in the future for someone reading code without the aid of a development environment.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache-HBase commented on pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#issuecomment-1052350237
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Comment |
|:----:|----------:|--------:|:--------|
| +0 :ok: | reexec | 1m 45s | Docker mode activated. |
||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | No case conflicting files found. |
| +0 :ok: | spotbugs | 0m 0s | spotbugs executables are not available. |
| +1 :green_heart: | @author | 0m 0s | The patch does not contain any @author tags. |
| +1 :green_heart: | test4tests | 0m 0s | The patch appears to include 1 new or modified test files. |
||| _ master Compile Tests _ |
| +1 :green_heart: | mvninstall | 0m 49s | master passed |
| +1 :green_heart: | compile | 0m 12s | master passed |
| +1 :green_heart: | checkstyle | 0m 29s | master passed |
| +1 :green_heart: | javadoc | 0m 6s | master passed |
||| _ Patch Compile Tests _ |
| +0 :ok: | mvndep | 0m 2s | Maven dependency ordering for patch |
| -1 :x: | mvninstall | 0m 3s | root in the patch failed. |
| -1 :x: | mvninstall | 0m 3s | hbase-unsafe in the patch failed. |
| -1 :x: | compile | 0m 4s | root in the patch failed. |
| -1 :x: | compile | 0m 3s | hbase-unsafe in the patch failed. |
| -1 :x: | javac | 0m 4s | root in the patch failed. |
| -1 :x: | javac | 0m 3s | hbase-unsafe in the patch failed. |
| -1 :x: | checkstyle | 0m 1s | The patch fails to run checkstyle in root |
| -1 :x: | checkstyle | 0m 1s | The patch fails to run checkstyle in hbase-unsafe |
| +1 :green_heart: | whitespace | 0m 0s | The patch has no whitespace issues. |
| +1 :green_heart: | xml | 0m 1s | The patch has no ill-formed XML file. |
| -1 :x: | javadoc | 0m 3s | root in the patch failed. |
| -1 :x: | javadoc | 0m 4s | hbase-unsafe in the patch failed. |
||| _ Other Tests _ |
| -1 :x: | unit | 0m 3s | root in the patch failed. |
| -1 :x: | unit | 0m 3s | hbase-unsafe in the patch failed. |
| +0 :ok: | asflicense | 0m 7s | ASF License check generated no output? |
| | | 4m 9s | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/Dockerfile |
| GITHUB PR | https://github.com/apache/hbase-thirdparty/pull/78 |
| Optional Tests | dupname asflicense javac javadoc unit xml compile spotbugs findbugs checkstyle |
| uname | Linux 0dbeb026e997 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 GNU/Linux |
| Build tool | maven |
| git revision | master / 3ecf75e |
| Default Java | Oracle Corporation-1.8.0_282-b08 |
| mvninstall | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-mvninstall-root.txt |
| mvninstall | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-mvninstall-hbase-unsafe.txt |
| compile | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-compile-root.txt |
| compile | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-compile-hbase-unsafe.txt |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-compile-root.txt |
| javac | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-compile-hbase-unsafe.txt |
| checkstyle | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/buildtool-patch-checkstyle-root.txt |
| checkstyle | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/buildtool-patch-checkstyle-hbase-unsafe.txt |
| javadoc | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-javadoc-root.txt |
| javadoc | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-javadoc-hbase-unsafe.txt |
| unit | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-unit-root.txt |
| unit | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/artifact/yetus-precommit-check/output/patch-unit-hbase-unsafe.txt |
| Test Results | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/testReport/ |
| Max. process+thread count | 39 (vs. ulimit of 1000) |
| modules | C: . hbase-unsafe U: . |
| Console output | https://ci-hbase.apache.org/job/HBase-Thirdparty-PreCommit/job/PR-78/1/console |
| versions | git=2.20.1 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r816377079
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafe0}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
Review comment:
I'm just fine with either name :)
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 merged pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 merged pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] Apache9 commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
Apache9 commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820724829
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+ @Override
+ public Boolean run() {
+ return checkAvailable();
+ }
+ });
+ UNALIGNED = checkUnaligned();
+ }
+
+ private static boolean checkAvailable() {
+ try {
+ Class<?> clazz = Class.forName(CLASS_NAME);
+ Field f = clazz.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Object theUnsafe = f.get(null);
+ if (theUnsafe == null) {
+ LOG.warn("Could not get static instance from sun.misc.Unsafe");
+ return false;
+ }
+ // Check for availability of all methods used by UnsafeAccess
+ Method m;
+ try {
+ m = clazz.getDeclaredMethod("arrayBaseOffset", Class.class);
+ if (m == null) {
Review comment:
This is the implementation of the 'Class', not Unsafe, so typically I agree with you that we should get a NoSuchMethodException. Anyway, not a big deal? Can open a new issue to remove these null checks...
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hbase-thirdparty] ndimiduk commented on a change in pull request #78: HBASE-26773 [hbase-thirdparty] Introduce a hbase-unsafe module in hba…
Posted by GitBox <gi...@apache.org>.
ndimiduk commented on a change in pull request #78:
URL: https://github.com/apache/hbase-thirdparty/pull/78#discussion_r820701254
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+
+ @Override
+ public Boolean run() {
+ return checkAvailable();
+ }
+ });
+ UNALIGNED = checkUnaligned();
+ }
+
+ private static boolean checkAvailable() {
+ try {
+ Class<?> clazz = Class.forName(CLASS_NAME);
+ Field f = clazz.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Object theUnsafe = f.get(null);
+ if (theUnsafe == null) {
+ LOG.warn("Could not get static instance from sun.misc.Unsafe");
+ return false;
+ }
+ // Check for availability of all methods used by UnsafeAccess
+ Method m;
+ try {
+ m = clazz.getDeclaredMethod("arrayBaseOffset", Class.class);
+ if (m == null) {
Review comment:
Static analysis says that `Class#getDeclaredMethod` never returns null, so none of these null checks are ever executed. I don't know how descriptive the system-generated error messages will be, but the nice helpful warn statements won't happen.
##########
File path: hbase-unsafe/src/main/java/org/apache/hadoop/hbase/unsafe/HBaseUnsafe.java
##########
@@ -0,0 +1,562 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.unsafe;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Delegate all methods of {@link HBaseUnsafeInternal}, so we will not touch the actual
+ * {@code sun.misc.Unsafe} class until we actually call the methods.
+ */
+public final class HBaseUnsafe {
+
+ private static final String CLASS_NAME = "sun.misc.Unsafe";
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseUnsafe.class);
+ private static final boolean AVAIL;
+ private static final boolean UNALIGNED;
+
+ static {
+ AVAIL = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
Review comment:
nit: implement as a lambda instead?
--
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: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org