From 397ba45b31fb1a4dbf696fa287f1eb411952694f Mon Sep 17 00:00:00 2001 From: Istvan Toth Date: Tue, 12 Dec 2023 10:41:40 +0100 Subject: [PATCH] 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 Signed-off-by: Balazs Meszaros (cherry picked from commit 5503962350d6a4fbb7d7e21c4f73a070707d847b) --- bin/hbase-config.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/hbase-config.sh b/bin/hbase-config.sh index 104e9a0b67c3..0e8b3feed213 100644 --- a/bin/hbase-config.sh +++ b/bin/hbase-config.sh @@ -178,8 +178,12 @@ EOF fi function read_java_version() { - properties="$("${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1)" - echo "${properties}" | "${GREP}" java.runtime.version | head -1 | "${SED}" -e 's/.* = \([^ ]*\)/\1/' + # Avoid calling java repeatedly + if [ -z "$read_java_version_cached" ]; then + properties="$("${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1)" + read_java_version_cached="$(echo "${properties}" | "${GREP}" java.runtime.version | head -1 | "${SED}" -e 's/.* = \([^ ]*\)/\1/')" + fi + echo "$read_java_version_cached" } # Inspect the system properties exposed by this JVM to identify the major