New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #550] Update java option setting to run in jdk9 #1035
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,20 +31,27 @@ error_exit () | |
export JAVA_HOME | ||
export JAVA="$JAVA_HOME/bin/java" | ||
export BASE_DIR=$(dirname $0)/.. | ||
export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} | ||
export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}:${BASE_DIR}/lib/* | ||
read JAVA_MAJOR_VERSION JAVA_MINOR_VERSION <<<$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F. '{print $1,$2}') | ||
|
||
#=========================================================================================== | ||
# JVM Configuration | ||
#=========================================================================================== | ||
JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" | ||
JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" | ||
JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" | ||
JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" | ||
# JDK9 don't support PrintGCDetails, and replace it with -Xlog:gc and -Xlog:gc* | ||
# JDK9 don't support -Djava.ext.dirs, and use -classpath instead. | ||
if [[ "$JAVA_MAJOR_VERSION" -lt 9 ]] ; then | ||
JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:/dev/shm/mq_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" | ||
JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" | ||
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" | ||
else | ||
JAVA_OPT="${JAVA_OPT} --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we need to add some corresponding parameters of GC log for JDK9 and above here? And other params like PrintGCApplicationStoppedTime and PrintAdaptiveSizePolicy are also needed to be transferred in JDK9. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I‘m not very familiar with the parameters. According to https://docs.oracle.com/javase/9/tools/java.htm#JSWOR-GUID-BE93ABDC-999C-4CB5-A88B-1994AAAC74D5,maybe we can use |
||
fi | ||
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" | ||
JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" | ||
JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=15g" | ||
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" | ||
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" | ||
#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" | ||
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" | ||
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for curiosity, do we need to add
${BASE_DIR}/lib
toDjava.ext.dirs
if already added${BASE_DIR}/lib
toCLASSPATH
when using JDK8?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, and i've updated the commit.