You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/08/12 22:33:31 UTC

[GitHub] [kafka] ijuma commented on a diff in pull request #12163: KAFKA-13900 Support Java 9 direct ByteBuffer Checksum methods

ijuma commented on code in PR #12163:
URL: https://github.com/apache/kafka/pull/12163#discussion_r944910841


##########
clients/src/main/java/org/apache/kafka/common/utils/Checksums.java:
##########
@@ -29,22 +32,72 @@
  * NOTE: This class is intended for INTERNAL usage only within Kafka.
  */
 public final class Checksums {
+    private static final MethodHandle BYTE_BUFFER_UPDATE;
+
+    static {
+        MethodHandle byteBufferUpdate = null;
+        if (Java.IS_JAVA9_COMPATIBLE) {
+            try {
+                byteBufferUpdate = MethodHandles.publicLookup().findVirtual(Checksum.class, "update",
+                    MethodType.methodType(void.class, ByteBuffer.class));
+            } catch (Throwable t) {
+                handleUpdateThrowable(t);

Review Comment:
   I changed this to throw an exception so that our tests fail if the optimization stops working due to a bug.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org