From 3f637efaa2ce02759df213b9f1aa747614f4167a Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 2 Oct 2024 10:45:25 +0800 Subject: [PATCH] HADOOP-19219. Add JPMS options required by hadoop-common (#7084) Contributed by Cheng Pan. Reviewed-by: Steve Loughran Signed-off-by: Shilun Fan --- .../hadoop-common/src/main/bin/hadoop-functions.sh | 14 ++++++++++++++ hadoop-project/pom.xml | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh index 919589cc9b289..a79e2cd1c6d70 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh @@ -1569,6 +1569,19 @@ function hadoop_finalize_hadoop_opts hadoop_add_param HADOOP_OPTS hadoop.security.logger "-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER}" } +## @description Finish configuring JPMS that enforced for JDK 17 and higher +## @description prior to executing Java +## @audience private +## @stability evolving +## @replaceable yes +function hadoop_finalize_jpms_opts +{ + hadoop_add_param HADOOP_OPTS IgnoreUnrecognizedVMOptions "-XX:+IgnoreUnrecognizedVMOptions" + hadoop_add_param HADOOP_OPTS open.java.util.zip "--add-opens=java.base/java.util.zip=ALL-UNNAMED" + hadoop_add_param HADOOP_OPTS open.sun.security.util "--add-opens=java.base/sun.security.util=ALL-UNNAMED" + hadoop_add_param HADOOP_OPTS open.sun.security.x509 "--add-opens=java.base/sun.security.x509=ALL-UNNAMED" +} + ## @description Finish Java classpath prior to execution ## @audience private ## @stability evolving @@ -1597,6 +1610,7 @@ function hadoop_finalize hadoop_finalize_libpaths hadoop_finalize_hadoop_heap hadoop_finalize_hadoop_opts + hadoop_finalize_jpms_opts hadoop_translate_cygwin_path HADOOP_HOME hadoop_translate_cygwin_path HADOOP_CONF_DIR diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 4a23dd909b572..91d8146fed30d 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -167,8 +167,14 @@ [${javac.version},) [3.3.0,) + + -XX:+IgnoreUnrecognizedVMOptions + --add-opens=java.base/java.util.zip=ALL-UNNAMED + --add-opens=java.base/sun.security.util=ALL-UNNAMED + --add-opens=java.base/sun.security.x509=ALL-UNNAMED + - -Xmx2048m -XX:+HeapDumpOnOutOfMemoryError + -Xmx2048m -XX:+HeapDumpOnOutOfMemoryError ${extraJavaTestArgs} 3.0.0-M1 ${maven-surefire-plugin.version} ${maven-surefire-plugin.version}