Adjust some JVM_OPTS

This commit is contained in:
Daniel Berteaud 2024-04-04 11:53:02 +02:00
parent 366ba6f219
commit aedf834476
1 changed files with 15 additions and 2 deletions

View File

@ -63,7 +63,20 @@ if [ -n "${TMPDIR}" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=${TMPDIR}"
fi
JAVA_OPTS="${JAVA_OPTS} -Xshare:off -Djava.awt.headless=true -Dfile.encoding=UTF8"
JAVA_OPTS="${JAVA_OPTS:-} -Djava.awt.headless=true -Dfile.encoding=UTF8"
# Disable class sharing (as only one JVM is running within a container)
JAVA_OPTS="${JAVA_OPTS} -Xshare:off"
# Enable container detection suport from JVM
JAVA_OPTS="${JAVA_OPTS} -XX:+UseContainerSupport"
# Enable Native memory tracking
JAVA_OPTS="${JAVA_OPTS} -XX:NativeMemoryTracking=summary"
# Force container to stop on OOM
JAVA_OPTS="${JAVA_OPTS} -XX:+ExitOnOutOfMemoryError"
if [ -z "${JVM_XMX}" ]; then
export JVM_XMX=$(printf "%.0f" $(echo $(get_max_mem)*${JVM_XMX_RATIO} | bc))m
@ -123,7 +136,7 @@ if [ -n "${NO_PROXY}" ]; then
done
# Remove leading |
JAVA_NO_PROXY=$(echo -n ${JAVA_NO_PROXY} | sed -E 's/^\|//')
JAVA_OPTS="${JAVA_OPTS} -Dhttp.nonProxyHosts='${JAVA_NO_PROXY}'"
JAVA_OPTS="${JAVA_OPTS} -Dhttp.nonProxyHosts=${JAVA_NO_PROXY}"
fi
echo "JAVA_OPTS=${JAVA_OPTS}"