Source of Java9Memory in Chronicle

253 Views Asked by At

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.

2

There are 2 best solutions below

0
Mark Price On BEST ANSWER

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
1
Peter Lawrey On

Java 9 support was separate as it was a moving target however we will be adding it as a sub module you can include if you need to run on java 9. This is still a work in progress.