Skip to content

Commit 1993048

Browse files
stotymeszibalu
authored andcommitted
HBASE-28252 Add sun.net.dns and sun.net.util to the JDK11+ module exports in the hbase script (#5571)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Balazs Meszaros <meszibalu@apache.org>
1 parent 276e083 commit 1993048

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

bin/hbase

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ add_jdk11_deps_to_classpath() {
496496
}
497497

498498
add_jdk11_jvm_flags() {
499-
HBASE_OPTS="$HBASE_OPTS -Dorg.apache.hbase.thirdparty.io.netty.tryReflectionSetAccessible=true --add-modules jdk.unsupported --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED"
499+
HBASE_OPTS="$HBASE_OPTS -Dorg.apache.hbase.thirdparty.io.netty.tryReflectionSetAccessible=true --add-modules jdk.unsupported --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-exports java.base/sun.net.dns=ALL-UNNAMED --add-exports java.base/sun.net.util=ALL-UNNAMED"
500500
}
501501

502502
add_opentelemetry_agent() {
@@ -786,7 +786,7 @@ fi
786786
# Add lib/jdk11 jars to the classpath
787787

788788
if [ "${DEBUG}" = "true" ]; then
789-
echo "Deciding on addition of lib/jdk11 jars to the classpath"
789+
echo "Deciding on addition of lib/jdk11 jars to the classpath and setting JVM module flags"
790790
fi
791791

792792
addJDK11Jars=false
@@ -879,6 +879,7 @@ export CLASSPATH
879879
if [ "${DEBUG}" = "true" ]; then
880880
echo "classpath=${CLASSPATH}" >&2
881881
HBASE_OPTS="${HBASE_OPTS} -Xdiag"
882+
echo "HBASE_OPTS=${HBASE_OPTS}"
882883
fi
883884

884885
# resolve the command arguments

bin/hbase-config.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ EOF
178178
fi
179179

180180
function read_java_version() {
181-
properties="$("${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1)"
182-
echo "${properties}" | "${GREP}" java.runtime.version | head -1 | "${SED}" -e 's/.* = \([^ ]*\)/\1/'
181+
# Avoid calling java repeatedly
182+
if [ -z "$read_java_version_cached" ]; then
183+
properties="$("${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1)"
184+
read_java_version_cached="$(echo "${properties}" | "${GREP}" java.runtime.version | head -1 | "${SED}" -e 's/.* = \([^ ]*\)/\1/')"
185+
fi
186+
echo "$read_java_version_cached"
183187
}
184188

185189
# Inspect the system properties exposed by this JVM to identify the major

0 commit comments

Comments
 (0)