Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/bookkeeper
Original file line number Diff line number Diff line change
Expand Up @@ -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'`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about jdk 11.0.1.8?
Will this check fail?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In BK we have another way to detect modern jdks with modules

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand better now, you added a double quote in the beginning so it should match only "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"
Expand Down
10 changes: 9 additions & 1 deletion bin/function-localrunner
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down