From 37db9c182128b6ef3eaaf6a796f031e4a748c188 Mon Sep 17 00:00:00 2001 From: Daoyuan Wang Date: Mon, 18 Aug 2014 11:10:39 +0800 Subject: [PATCH] code refine --- .../apache/spark/deploy/worker/CommandUtils.scala | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala b/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala index 0a8510d32a695..3c1096117eb37 100644 --- a/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala @@ -64,8 +64,6 @@ object CommandUtils extends Logging { Seq() } - val permGenOpt = Seq("-XX:MaxPermSize=128m") - // Figure out our classpath with the external compute-classpath script val ext = if (System.getProperty("os.name").startsWith("Windows")) ".cmd" else ".sh" val classPath = Utils.executeAndGetOutput( @@ -77,13 +75,9 @@ object CommandUtils extends Logging { val jvmversion = Utils.executeAndGetOutput(Seq(runner + " -version "), extraEnvironment = command.environment) val version = jvmversion.substring(jvmversion.indexOf("\"") + 1, jvmversion.indexOf("_")) - if (version.compareTo("1.8.0") < 0) { - Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++ - permGenOpt ++ libraryOpts ++ workerLocalOpts ++ command.javaOpts ++ memoryOpts - } else { - Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++ - libraryOpts ++ workerLocalOpts ++ command.javaOpts ++ memoryOpts - } + val permGenOpt = if (version.compareTo("1.8.0") < 0) Some("-XX:MaxPermSize=128m") else None + Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++ + permGenOpt ++ libraryOpts ++ workerLocalOpts ++ command.javaOpts ++ memoryOpts } /** Spawn a thread that will redirect a given stream to a file */