From 96bcfd47d8188e13efde2b08f9262b87f9b31376 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sat, 6 Apr 2019 16:35:07 +0900 Subject: [PATCH 1/3] initial commit --- .../src/main/scala/org/apache/spark/util/SizeEstimator.scala | 5 +++-- .../java/org/apache/spark/launcher/CommandBuilderUtils.java | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala b/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala index 4837b01d817ab..65c32b51eed2a 100644 --- a/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala +++ b/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala @@ -131,8 +131,9 @@ object SizeEstimator extends Logging { return System.getProperty(TEST_USE_COMPRESSED_OOPS_KEY).toBoolean } - // java.vm.info provides compressed ref info for IBM JDKs - if (System.getProperty("java.vendor").contains("IBM")) { + // java.vm.info provides compressed ref info for IBM and OpenJ9 JDKs + if (System.getProperty("java.vendor").contains("IBM") || + System.getProperty("java.vendor").contains("OpenJ9")) { return System.getProperty("java.vm.info").contains("Compressed Ref") } diff --git a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java index 47d2f8ef4e3df..1cf67de3c191d 100644 --- a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java +++ b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java @@ -33,7 +33,7 @@ class CommandBuilderUtils { /** The set of known JVM vendors. */ enum JavaVendor { - Oracle, IBM, OpenJDK, Unknown + Oracle, IBM, OpenJDK, OpenJ9, Unknown } /** Returns whether the given string is null or empty. */ @@ -124,6 +124,9 @@ static JavaVendor getJavaVendor() { if (vendorString.contains("OpenJDK")) { return JavaVendor.OpenJDK; } + if (vendorString.contains("OpenJ9")) { + return JavaVendor.OpenJ9; + } return JavaVendor.Unknown; } From 626548187ca289e5b94754dad53f5b152b79c185 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sun, 7 Apr 2019 08:17:49 +0900 Subject: [PATCH 2/3] address review comment --- core/src/main/scala/org/apache/spark/util/SizeEstimator.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala b/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala index 65c32b51eed2a..e09f1fc16f6f3 100644 --- a/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala +++ b/core/src/main/scala/org/apache/spark/util/SizeEstimator.scala @@ -132,8 +132,8 @@ object SizeEstimator extends Logging { } // java.vm.info provides compressed ref info for IBM and OpenJ9 JDKs - if (System.getProperty("java.vendor").contains("IBM") || - System.getProperty("java.vendor").contains("OpenJ9")) { + val javaVendor = System.getProperty("java.vendor") + if (javaVendor.contains("IBM") || javaVendor.contains("OpenJ9")) { return System.getProperty("java.vm.info").contains("Compressed Ref") } From 08eb67a8a64de927192b05024f2e23c4db54a0dd Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Mon, 15 Apr 2019 10:54:19 +0900 Subject: [PATCH 3/3] address review comment --- .../spark/launcher/CommandBuilderUtils.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java index 1cf67de3c191d..172fb8c560876 100644 --- a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java +++ b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java @@ -31,11 +31,6 @@ class CommandBuilderUtils { static final String DEFAULT_PROPERTIES_FILE = "spark-defaults.conf"; static final String ENV_SPARK_HOME = "SPARK_HOME"; - /** The set of known JVM vendors. */ - enum JavaVendor { - Oracle, IBM, OpenJDK, OpenJ9, Unknown - } - /** Returns whether the given string is null or empty. */ static boolean isEmpty(String s) { return s == null || s.isEmpty(); @@ -112,24 +107,6 @@ static boolean isWindows() { return os.startsWith("Windows"); } - /** Returns an enum value indicating whose JVM is being used. */ - static JavaVendor getJavaVendor() { - String vendorString = System.getProperty("java.vendor"); - if (vendorString.contains("Oracle")) { - return JavaVendor.Oracle; - } - if (vendorString.contains("IBM")) { - return JavaVendor.IBM; - } - if (vendorString.contains("OpenJDK")) { - return JavaVendor.OpenJDK; - } - if (vendorString.contains("OpenJ9")) { - return JavaVendor.OpenJ9; - } - return JavaVendor.Unknown; - } - /** * Updates the user environment, appending the given pathList to the existing value of the given * environment variable (or setting it if it hasn't yet been set).