[fix][jdk17] remove illegal access warning and enable reads optimization on jdk17#14999
Merged
Merged
Conversation
…optimization on jdk17
merlimat
approved these changes
Apr 2, 2022
eolivelli
requested changes
Apr 2, 2022
| # Allow Netty to use reflection access | ||
| OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true" | ||
|
|
||
| IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'` |
Contributor
There was a problem hiding this comment.
What about jdk 11.0.1.8?
Will this check fail?
Contributor
There was a problem hiding this comment.
In BK we have another way to detect modern jdks with modules
Contributor
There was a problem hiding this comment.
I understand better now, you added a double quote in the beginning so it should match only "1.8
eolivelli
approved these changes
Apr 2, 2022
Nicklee007
pushed a commit
to Nicklee007/pulsar
that referenced
this pull request
Apr 20, 2022
…ion on jdk17 (apache#14999) * [fix][bookie] Bookie: remove illegal access warning and enable reads optimization on jdk17
1 task
nicoloboschi
added a commit
to datastax/pulsar
that referenced
this pull request
Jan 18, 2023
…ion on jdk17 (apache#14999) * [fix][bookie] Bookie: remove illegal access warning and enable reads optimization on jdk17 (cherry picked from commit 94cc46a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In BookKeeper there's an optimization in order to improve file reads on Linux using
posix_fadvisenative instructions.In order to do that it needs to access
java.io.FileDescriptorusing the reflection.For Netty there is the
java.nio.DirectBufferusage with it's currently used in Pulsar and it should improve the direct memory footprint.At the moment:
Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/Users/nicolo.boschi/.m2/repository/io/netty/netty-common/4.1.74.Final/netty-common-4.1.74.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)This pull is also intended to keep the same behavior across JDK11 and JDK17.
Modifications
--add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/sun.nio=ALL-UNNAMEDto the command line inside ´bin´ directory and allow reflections on java.io package. This option is available only starting from Java 9.note: this is not documented on BookKeeper project, I will follow-up there.
no-need-doc