Skip to content

Commit d8d3717

Browse files
author
Andrew Or
committed
Use a daemon thread pool for REST server
The motivation is to fix failing tests SparkSubmitSuite and DriverSuite.
1 parent 6568ca5 commit d8d3717

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/main/scala/org/apache/spark/deploy/rest/SubmitRestServer.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import scala.io.Source
2626
import com.google.common.base.Charsets
2727
import org.eclipse.jetty.server.{Request, Server}
2828
import org.eclipse.jetty.server.handler.AbstractHandler
29+
import org.eclipse.jetty.util.thread.QueuedThreadPool
2930

3031
import org.apache.spark.{SPARK_VERSION => sparkVersion, Logging, SparkConf}
3132
import org.apache.spark.util.Utils
@@ -52,6 +53,9 @@ private[spark] abstract class SubmitRestServer(host: String, requestedPort: Int,
5253

5354
private def doStart(startPort: Int): (Server, Int) = {
5455
val server = new Server(new InetSocketAddress(host, requestedPort))
56+
val threadPool = new QueuedThreadPool
57+
threadPool.setDaemon(true)
58+
server.setThreadPool(threadPool)
5559
server.setHandler(handler)
5660
server.start()
5761
val boundPort = server.getConnectors()(0).getLocalPort

core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ class SparkSubmitSuite extends FunSuite with Matchers with ResetSystemProperties
264264
"--name", "testApp",
265265
"--master", "local",
266266
"--conf", "spark.ui.enabled=false",
267-
"--conf", "spark.master.rest.enabled=false",
268267
unusedJar.toString)
269268
runSparkSubmit(args)
270269
}
@@ -280,7 +279,6 @@ class SparkSubmitSuite extends FunSuite with Matchers with ResetSystemProperties
280279
"--master", "local-cluster[2,1,512]",
281280
"--jars", jarsString,
282281
"--conf", "spark.ui.enabled=false",
283-
"--conf", "spark.master.rest.enabled=false",
284282
unusedJar.toString)
285283
runSparkSubmit(args)
286284
}

0 commit comments

Comments
 (0)