Skip to content
Snippets Groups Projects
Commit e676fc0c authored by Tim Ellison's avatar Tim Ellison Committed by Sean Owen
Browse files

[MINOR] Avoid passing the PermGenSize option to IBM JVMs.

IBM's Java VM doesn't have the concept of a permgen, so this option shouldn't be passed when the vendor property shows it is an IBM JDK.

Author: Tim Ellison <t.p.ellison@gmail.com>
Author: Tim Ellison <tellison@users.noreply.github.com>

Closes #6055 from tellison/MaxPermSize and squashes the following commits:

3a0fb66 [Tim Ellison] Convert tabs back to spaces
6ad4266 [Tim Ellison] Remove unnecessary else clauses to reduce nesting.
d27174b [Tim Ellison] Merge branch 'master' of https://github.com/apache/spark into MaxPermSize
42a8c3f [Tim Ellison] [MINOR] Avoid passing the PermGenSize option to IBM JVMs.
parent 213a6f30
No related branches found
No related tags found
No related merge requests found
...@@ -121,7 +121,10 @@ abstract class AbstractCommandBuilder { ...@@ -121,7 +121,10 @@ abstract class AbstractCommandBuilder {
* set it. * set it.
*/ */
void addPermGenSizeOpt(List<String> cmd) { void addPermGenSizeOpt(List<String> cmd) {
// Don't set MaxPermSize for Java 8 and later. // Don't set MaxPermSize for IBM Java, or Oracle Java 8 and later.
if (getJavaVendor() == JavaVendor.IBM) {
return;
}
String[] version = System.getProperty("java.version").split("\\."); String[] version = System.getProperty("java.version").split("\\.");
if (Integer.parseInt(version[0]) > 1 || Integer.parseInt(version[1]) > 7) { if (Integer.parseInt(version[0]) > 1 || Integer.parseInt(version[1]) > 7) {
return; return;
......
...@@ -32,6 +32,11 @@ class CommandBuilderUtils { ...@@ -32,6 +32,11 @@ class CommandBuilderUtils {
static final String ENV_SPARK_HOME = "SPARK_HOME"; static final String ENV_SPARK_HOME = "SPARK_HOME";
static final String ENV_SPARK_ASSEMBLY = "_SPARK_ASSEMBLY"; static final String ENV_SPARK_ASSEMBLY = "_SPARK_ASSEMBLY";
/** The set of known JVM vendors. */
static enum JavaVendor {
Oracle, IBM, OpenJDK, Unknown
};
/** Returns whether the given string is null or empty. */ /** Returns whether the given string is null or empty. */
static boolean isEmpty(String s) { static boolean isEmpty(String s) {
return s == null || s.isEmpty(); return s == null || s.isEmpty();
...@@ -108,6 +113,21 @@ class CommandBuilderUtils { ...@@ -108,6 +113,21 @@ class CommandBuilderUtils {
return os.startsWith("Windows"); 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;
}
return JavaVendor.Unknown;
}
/** /**
* Updates the user environment, appending the given pathList to the existing value of the given * 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). * environment variable (or setting it if it hasn't yet been set).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment