On 12/09/2024 15:15, Rémy Maucherat wrote:
Hi,
This JEP has the potential to have a significant impact with Tomcat's
JNI use starting with Java 26.
https://openjdk.org/jeps/471
Unsafe.invokeCleaner will be removed, which will effectively prevent
using the direct ByteBuffers that are needed for tomcat-native. The
solution is to use a memory segment from FFM, then call
MemorySegment.asByteBuffer, which creates a direct ByteBuffer with a
controllable lifecycle. So using JNI would require FFM and using the
full FFM code instead should make more sense.
+1.
We will of course have to see how things turn out ...
FFM is looking more and more like the way to go.
Another, less problematic, yet still annoying change will be
https://openjdk.org/jeps/472 in Java 24+. Basically, the native access
flag use will become mandatory. This is a bit annoying since it is not
possible to add "--enable-native-access=ALL-UNNAMED" in the default
command line without breaking on older Java.
So we have issues when running older Tomcats that have to work with JREs
that don't have FFM - hence they need JNI.
We have had issues like this before and have managed to hack around
them. Maybe it is time for slightly more robust solution. I was thinking
something like:
- new class in bootstrap JAR with a main method that just returns the
current major java version as the exit code
- the startup scripts call java with that class and store exit code in a
variable
- we use that variable to select what to include when composing the main
command line to start Tomcat.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org