You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zh...@apache.org on 2022/05/06 05:30:31 UTC
[pulsar] branch master updated: [fix][env]Fix potential incompatible java opts caused by IS_JAVA_8 (#15444)
This is an automated email from the ASF dual-hosted git repository.
zhangmingao 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 acccfa94ef9 [fix][env]Fix potential incompatible java opts caused by IS_JAVA_8 (#15444)
acccfa94ef9 is described below
commit acccfa94ef99b767e685b39ab45f5fafbab1c6aa
Author: gaozhangmin <ga...@qq.com>
AuthorDate: Fri May 6 13:30:24 2022 +0800
[fix][env]Fix potential incompatible java opts caused by IS_JAVA_8 (#15444)
* Fix potential incompatible java opts caused by IS_JAVA_8
* apply reviews
Co-authored-by: gavingaozhangmin <ga...@didiglobal.com>
---
bin/bookkeeper | 2 +-
bin/function-localrunner | 24 ++++++++++++------------
bin/pulsar | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/bin/bookkeeper b/bin/bookkeeper
index 1142a68e96f..ed2889c9057 100755
--- a/bin/bookkeeper
+++ b/bin/bookkeeper
@@ -166,7 +166,7 @@ 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'`
+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
diff --git a/bin/function-localrunner b/bin/function-localrunner
index c9e9892e51e..c15ea58ba46 100755
--- a/bin/function-localrunner
+++ b/bin/function-localrunner
@@ -23,13 +23,24 @@ export PULSAR_HOME=`cd -P $BINDIR/..;pwd`
DEFAULT_LOG_CONF=$PULSAR_HOME/conf/log4j2.yaml
+# Check for the java to use
+if [[ -z $JAVA_HOME ]]; then
+ JAVA=$(which java)
+ if [ $? != 0 ]; then
+ echo "Error: JAVA_HOME not set, and no java executable found in $PATH." 1>&2
+ exit 1
+ fi
+else
+ JAVA=$JAVA_HOME/bin/java
+fi
+
PULSAR_MEM=${PULSAR_MEM:-"-Xmx128m -XX:MaxDirectMemorySize=128m"}
# Garbage collection options
PULSAR_GC=${PULSAR_GC:-"-XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+DoEscapeAnalysis -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC"}
# Garbage collection log.
-IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'`
+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
PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xloggc:logs/pulsar_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}
@@ -41,17 +52,6 @@ fi
# Extra options to be passed to the jvm
PULSAR_EXTRA_OPTS=${PULSAR_EXTRA_OPTS:-" -Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacityPerThread=4096"}
-# Check for the java to use
-if [[ -z $JAVA_HOME ]]; then
- JAVA=$(which java)
- if [ $? != 0 ]; then
- echo "Error: JAVA_HOME not set, and no java executable found in $PATH." 1>&2
- exit 1
- fi
-else
- JAVA=$JAVA_HOME/bin/java
-fi
-
if [ -z "$PULSAR_LOG_CONF" ]; then
PULSAR_LOG_CONF=$DEFAULT_LOG_CONF
fi
diff --git a/bin/pulsar b/bin/pulsar
index 5371ef2e6ea..1d1f7eb3e50 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -273,7 +273,7 @@ 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'`
+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