Skip to content

Commit e99a794

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 a46f736 commit e99a794

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bin/hbase

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ add_jdk11_deps_to_classpath() {
491491
}
492492

493493
add_jdk11_jvm_flags() {
494-
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"
494+
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"
495495
}
496496

497497
add_opentelemetry_agent() {
@@ -749,7 +749,7 @@ fi
749749
# Add lib/jdk11 jars to the classpath
750750

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

755755
addJDK11Jars=false
@@ -842,6 +842,7 @@ export CLASSPATH
842842
if [ "${DEBUG}" = "true" ]; then
843843
echo "classpath=${CLASSPATH}" >&2
844844
HBASE_OPTS="${HBASE_OPTS} -Xdiag"
845+
echo "HBASE_OPTS=${HBASE_OPTS}"
845846
fi
846847

847848
# 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)