[ https://issues.apache.org/jira/browse/HADOOP-15033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16321830#comment-16321830 ]
ASF GitHub Bot commented on HADOOP-15033: ----------------------------------------- Github user dchuyko commented on a diff in the pull request: https://github.com/apache/hadoop/pull/291#discussion_r160883520 --- Diff: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/DataChecksum.java --- @@ -43,6 +49,9 @@ public static final int CHECKSUM_CRC32C = 2; public static final int CHECKSUM_DEFAULT = 3; public static final int CHECKSUM_MIXED = 4; + + private static final Logger LOG = LoggerFactory.getLogger(DataChecksum.class); + private static volatile boolean useJava9Crc32C = Shell.isJavaVersionAtLeast(9); --- End diff -- @aajisaka The initial design was to have constructor method handle as static final in the main class and to not use the flag at all. There was a concern that Java may not work as it must work: class or its constructor available by spec won't be found by standard means or there will be an error during invocation. I'd assume that in this case it would be fine to fail globally. Also some code around this stuff may be considered possible to fail. These scenarios are described by try-catch blocks. In case something bad has happened on 9+ we switch the flag to use old internal plain java implementation and log the error. The API should be thread safe/correct so we can imagine a race where multiple threads try the initialization, get errors and put down the flag. > Use java.util.zip.CRC32C for Java 9 and above > --------------------------------------------- > > Key: HADOOP-15033 > URL: https://issues.apache.org/jira/browse/HADOOP-15033 > Project: Hadoop Common > Issue Type: Improvement > Components: performance, util > Affects Versions: 3.0.0 > Reporter: Dmitry Chuyko > Labels: Java9, common, jdk9 > Attachments: HADOOP-15033.001.patch, HADOOP-15033.001.patch, > HADOOP-15033.002.patch, HADOOP-15033.003.patch, HADOOP-15033.003.patch, > HADOOP-15033.004.patch, HADOOP-15033.005.diff, HADOOP-15033.005.diff, > HADOOP-15033.005.diff, HADOOP-15033.005.patch, HADOOP-15033.006.patch, > HADOOP-15033.007.patch, HADOOP-15033.007.patch, HADOOP-15033.008.patch, > HADOOP-15033.009.patch, HADOOP-15033.009.patch, HADOOP-15033.009.patch, > HADOOP-15033.009.patch, HADOOP-15033.009.patch, HADOOP-15033.009.patch, > HADOOP-15033.009.patch, HADOOP-15033.010.patch > > > java.util.zip.CRC32C implementation is available since Java 9. > https://docs.oracle.com/javase/9/docs/api/java/util/zip/CRC32C.html > Platform specific assembler intrinsics make it more effective than any pure > Java implementation. > Hadoop is compiled against Java 8 but class constructor may be accessible > with method handle on 9 to instances implementing Checksum in runtime. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org