javachronicleoff-heap

Source of Java9Memory in Chronicle


I got curious on the off-heap mechanism used by the openHFT project and am looking for the class file below (couldn't find anywhere in github) as defined by the source code here:

Class<? extends Memory> java9MemoryClass = Class
                    .forName("software.chronicle.enterprise.core.Java9Memory")
                    .asSubclass(Memory.class);

From the github repository: https://github.com/OpenHFT/Chronicle-Core/blob/master/src/main/java/net/openhft/chronicle/core/OS.java

My question is: Is this class open source? If yes, how does it work? Thanks.


Solution

  • This class is not available, and will be removed in future.

    Our current approach to Java9 compatibility is to publish OpenHFT artifacts built to target language-level 1.8. Any incompatibilities in the Java runtime (such as class renames) will be dealt with by making your program require a Java9 module that will contain Java9-specific overrides.

    In answer to your question of how the class works - Chronicle libraries will continue to utilise sun.misc.Unsafe when running on a version 9 JVM. It will be necessary to manually add exports to the command in order to allow this, e.g.:

    --add-exports=java.unsupported/sun.misc=ALL-UNNAMED