Skip to content

Commit

Permalink
[fix][jdk17] Enable Netty and BookKeeper IO optimizations on jdk17 (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi authored Apr 22, 2022
1 parent 5582e5c commit 2d12011
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions bin/bookkeeper
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'`
# Start --add-opens options
# '--add-opens' option is not supported in jdk8
if [[ -z "$IS_JAVA_8" ]]; then
# BookKeeper: enable posix_fadvise usage
OPTS="$OPTS --add-opens java.base/java.io=ALL-UNNAMED"
# BookKeeper: enable posix_fadvise usage and DirectMemoryCRC32Digest (https://github.com/apache/bookkeeper/pull/3234)
OPTS="$OPTS --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util.zip=ALL-UNNAMED"
# Netty: enable java.nio.DirectByteBuffer
# https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/PlatformDependent0.java
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED"
# https://github.com/netty/netty/issues/12265
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
fi

OPTS="-cp $BOOKIE_CLASSPATH $OPTS"
Expand Down
3 changes: 2 additions & 1 deletion bin/function-localrunner
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
if [[ -z "$IS_JAVA_8" ]]; then
# Netty: enable java.nio.DirectByteBuffer
# https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/PlatformDependent0.java
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED"
# https://github.com/netty/netty/issues/12265
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
fi

# Ensure we can read bigger content from ZK. (It might be
Expand Down
7 changes: 4 additions & 3 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'`
# Start --add-opens options
# '--add-opens' option is not supported in jdk8
if [[ -z "$IS_JAVA_8" ]]; then
# BookKeeper: enable posix_fadvise usage
OPTS="$OPTS --add-opens java.base/java.io=ALL-UNNAMED"
# BookKeeper: enable posix_fadvise usage and DirectMemoryCRC32Digest (https://github.com/apache/bookkeeper/pull/3234)
OPTS="$OPTS --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util.zip=ALL-UNNAMED"
# Netty: enable java.nio.DirectByteBuffer
# https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/internal/PlatformDependent0.java
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED"
# https://github.com/netty/netty/issues/12265
OPTS="$OPTS --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED"
fi

OPTS="-cp $PULSAR_CLASSPATH $OPTS"
Expand Down

0 comments on commit 2d12011

Please sign in to comment.