Skip to content

Commit 035069b

Browse files
better code style
1 parent d3ddfb6 commit 035069b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,12 @@ private List<String> buildSparkSubmitCommand(Map<String, String> env) throws IOE
205205
// - SPARK_DRIVER_MEMORY env variable
206206
// - SPARK_MEM env variable
207207
// - default value (512m)
208-
String memory;
209208
// Take Thrift Server as daemon
210-
if (isThriftServer(mainClass)) {
211-
memory = firstNonEmpty(System.getenv("SPARK_DAEMON_MEMORY"),
212-
firstNonEmptyValue(SparkLauncher.DRIVER_MEMORY, conf, props),
213-
System.getenv("SPARK_DRIVER_MEMORY"), System.getenv("SPARK_MEM"), DEFAULT_MEM);
214-
} else {
215-
memory = firstNonEmpty(firstNonEmptyValue(SparkLauncher.DRIVER_MEMORY, conf, props),
216-
System.getenv("SPARK_DRIVER_MEMORY"), System.getenv("SPARK_MEM"), DEFAULT_MEM);
217-
}
209+
String tsMemory =
210+
isThriftServer(mainClass) ? System.getenv("SPARK_DAEMON_MEMORY") : null;
211+
String memory = firstNonEmpty(tsMemory,
212+
firstNonEmptyValue(SparkLauncher.DRIVER_MEMORY, conf, props),
213+
System.getenv("SPARK_DRIVER_MEMORY"), System.getenv("SPARK_MEM"), DEFAULT_MEM);
218214
cmd.add("-Xms" + memory);
219215
cmd.add("-Xmx" + memory);
220216
addOptionString(cmd, firstNonEmptyValue(SparkLauncher.DRIVER_EXTRA_JAVA_OPTIONS, conf, props));

0 commit comments

Comments
 (0)