@@ -19,7 +19,6 @@ package org.apache.spark.deploy.yarn
1919
2020import java .io .File
2121import java .net .{InetAddress , UnknownHostException , URI , URISyntaxException }
22- import java .nio .ByteBuffer
2322
2423import scala .collection .JavaConversions ._
2524import scala .collection .mutable .{HashMap , ListBuffer , Map }
@@ -37,7 +36,7 @@ import org.apache.hadoop.yarn.api.ApplicationConstants.Environment
3736import org .apache .hadoop .yarn .api .protocolrecords ._
3837import org .apache .hadoop .yarn .api .records ._
3938import org .apache .hadoop .yarn .conf .YarnConfiguration
40- import org .apache .hadoop .yarn .util .{ Apps , Records }
39+ import org .apache .hadoop .yarn .util .Records
4140import org .apache .spark .{Logging , SparkConf , SparkContext }
4241
4342/**
@@ -169,14 +168,13 @@ trait ClientBase extends Logging {
169168 destPath
170169 }
171170
172- def qualifyForLocal (localURI : URI ): Path = {
171+ private def qualifyForLocal (localURI : URI ): Path = {
173172 var qualifiedURI = localURI
174- // If not specified assume these are in the local filesystem to keep behavior like Hadoop
173+ // If not specified, assume these are in the local filesystem to keep behavior like Hadoop
175174 if (qualifiedURI.getScheme() == null ) {
176175 qualifiedURI = new URI (FileSystem .getLocal(conf).makeQualified(new Path (qualifiedURI)).toString)
177176 }
178- val qualPath = new Path (qualifiedURI)
179- qualPath
177+ new Path (qualifiedURI)
180178 }
181179
182180 def prepareLocalResources (appStagingDir : String ): HashMap [String , LocalResource ] = {
@@ -305,13 +303,13 @@ trait ClientBase extends Logging {
305303
306304 val amMemory = calculateAMMemory(newApp)
307305
308- val JAVA_OPTS = ListBuffer [String ]()
306+ val javaOpts = ListBuffer [String ]()
309307
310308 // Add Xmx for AM memory
311- JAVA_OPTS += " -Xmx" + amMemory + " m"
309+ javaOpts += " -Xmx" + amMemory + " m"
312310
313311 val tmpDir = new Path (Environment .PWD .$(), YarnConfiguration .DEFAULT_CONTAINER_TEMP_DIR )
314- JAVA_OPTS += " -Djava.io.tmpdir=" + tmpDir
312+ javaOpts += " -Djava.io.tmpdir=" + tmpDir
315313
316314 // TODO: Remove once cpuset version is pushed out.
317315 // The context is, default gc for server class machines ends up using all cores to do gc -
@@ -325,11 +323,11 @@ trait ClientBase extends Logging {
325323 if (useConcurrentAndIncrementalGC) {
326324 // In our expts, using (default) throughput collector has severe perf ramifications in
327325 // multi-tenant machines
328- JAVA_OPTS += " -XX:+UseConcMarkSweepGC"
329- JAVA_OPTS += " -XX:+CMSIncrementalMode"
330- JAVA_OPTS += " -XX:+CMSIncrementalPacing"
331- JAVA_OPTS += " -XX:CMSIncrementalDutyCycleMin=0"
332- JAVA_OPTS += " -XX:CMSIncrementalDutyCycle=10"
326+ javaOpts += " -XX:+UseConcMarkSweepGC"
327+ javaOpts += " -XX:+CMSIncrementalMode"
328+ javaOpts += " -XX:+CMSIncrementalPacing"
329+ javaOpts += " -XX:CMSIncrementalDutyCycleMin=0"
330+ javaOpts += " -XX:CMSIncrementalDutyCycle=10"
333331 }
334332
335333 // SPARK_JAVA_OPTS is deprecated, but for backwards compatibility:
@@ -344,22 +342,22 @@ trait ClientBase extends Logging {
344342 // If we are being launched in client mode, forward the spark-conf options
345343 // onto the executor launcher
346344 for ((k, v) <- sparkConf.getAll) {
347- JAVA_OPTS += " -D" + k + " =" + " \\\" " + v + " \\\" "
345+ javaOpts += " -D" + k + " =" + " \\\" " + v + " \\\" "
348346 }
349347 } else {
350348 // If we are being launched in standalone mode, capture and forward any spark
351349 // system properties (e.g. set by spark-class).
352350 for ((k, v) <- sys.props.filterKeys(_.startsWith(" spark" ))) {
353- JAVA_OPTS += " -D" + k + " =" + " \\\" " + v + " \\\" "
351+ javaOpts += " -D" + k + " =" + " \\\" " + v + " \\\" "
354352 }
355- sys.props.get(" spark.driver.extraJavaOptions" ).foreach(opts => JAVA_OPTS += opts)
356- sys.props.get(" spark.driver.libraryPath" ).foreach(p => JAVA_OPTS += s " -Djava.library.path= $p" )
353+ sys.props.get(" spark.driver.extraJavaOptions" ).foreach(opts => javaOpts += opts)
354+ sys.props.get(" spark.driver.libraryPath" ).foreach(p => javaOpts += s " -Djava.library.path= $p" )
357355 }
358- JAVA_OPTS += ClientBase .getLog4jConfiguration(localResources)
356+ javaOpts += ClientBase .getLog4jConfiguration(localResources)
359357
360358 // Command for the ApplicationMaster
361359 val commands = Seq (Environment .JAVA_HOME .$() + " /bin/java" , " -server" ) ++
362- JAVA_OPTS ++
360+ javaOpts ++
363361 Seq (args.amClass, " --class" , args.userClass, " --jar " , args.userJar,
364362 userArgsToString(args),
365363 " --executor-memory" , args.executorMemory.toString,
0 commit comments