This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 94cc46a  [fix][jdk17] remove illegal access warning and enable reads 
optimization on jdk17 (#14999)
94cc46a is described below

commit 94cc46a66fbe322472dbb657803d21320e59079c
Author: Nicolò Boschi <[email protected]>
AuthorDate: Sat Apr 2 21:33:47 2022 +0200

    [fix][jdk17] remove illegal access warning and enable reads optimization on 
jdk17 (#14999)
    
    * [fix][bookie] Bookie: remove illegal access warning and enable reads 
optimization on jdk17
---
 bin/bookkeeper           | 11 +++++++++++
 bin/function-localrunner | 10 +++++++++-
 bin/pulsar               | 10 ++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/bin/bookkeeper b/bin/bookkeeper
index 428e975..b2f2638 100755
--- a/bin/bookkeeper
+++ b/bin/bookkeeper
@@ -166,6 +166,17 @@ OPTS="$OPTS -Dlog4j.configurationFile=`basename 
$BOOKIE_LOG_CONF`"
 # Allow Netty to use reflection access
 OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
 
+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"
+  # 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"
+fi
+
 OPTS="-cp $BOOKIE_CLASSPATH $OPTS"
 
 OPTS="$OPTS $BOOKIE_MEM $BOOKIE_GC $BOOKIE_GC_LOG $BOOKIE_EXTRA_OPTS"
diff --git a/bin/function-localrunner b/bin/function-localrunner
index b72c4ba..13f1ae2 100755
--- a/bin/function-localrunner
+++ b/bin/function-localrunner
@@ -31,7 +31,7 @@ PULSAR_GC=${PULSAR_GC:-"-XX:+UseG1GC -XX:MaxGCPauseMillis=10 
-XX:+ParallelRefPro
 # Garbage collection log.
 IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'`
 # java version has space, use [[ -n $PARAM ]] to judge if variable exists
-if [[ -n $IS_JAVA_8 ]]; then
+if [[ -n "$IS_JAVA_8" ]]; then
   PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xloggc:logs/pulsar_gc_%p.log 
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation 
-XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}
 else
 # After jdk 9, gc log param should config like this. Ignoring version less 
than jdk 8
@@ -89,6 +89,14 @@ OPTS="$OPTS -Dlog4j.configurationFile=`basename 
$PULSAR_LOG_CONF`"
 # Allow Netty to use reflection access
 OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
 
+# Start --add-opens options
+# '--add-opens' option is not supported in jdk8
+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"
+fi
+
 # Ensure we can read bigger content from ZK. (It might be
 # rarely needed when trying to list many z-nodes under a
 # directory)
diff --git a/bin/pulsar b/bin/pulsar
index 43e137af..3fa1848 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -273,6 +273,16 @@ OPTS="$OPTS -Djute.maxbuffer=10485760 
-Djava.net.preferIPv4Stack=true"
 
 # Allow Netty to use reflection access
 OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
+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"
+  # 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"
+fi
 
 OPTS="-cp $PULSAR_CLASSPATH $OPTS"
 

Reply via email to