Skip to content

Commit b8e7181

Browse files
Luc Bourliertnachen
authored andcommitted
Adds a shutdown latch to keep the deamon running
1 parent 0fa7780 commit b8e7181

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/src/main/scala/org/apache/spark/deploy/mesos/MesosClusterDispatcher.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ package org.apache.spark.deploy.mesos
1919

2020
import org.apache.spark.{Logging, SecurityManager, SparkConf}
2121
import org.apache.spark.util.{IntParam, Utils}
22-
2322
import java.io.File
2423
import org.apache.spark.deploy.mesos.ui.MesosClusterUI
2524
import org.apache.spark.deploy.rest.MesosRestServer
2625
import org.apache.spark.scheduler.cluster.mesos.{ClusterScheduler, MesosClusterScheduler}
26+
import java.util.concurrent.CountDownLatch
2727

2828
/*
2929
* A dispatcher actor that is responsible for managing drivers, that is intended to
@@ -63,6 +63,9 @@ private [spark] class MesosClusterDispatcher(
6363
}
6464

6565
object MesosClusterDispatcher {
66+
67+
val shutdownLatch = new CountDownLatch(1)
68+
6669
def main(args: Array[String]) {
6770
val conf = new SparkConf
6871
val dispatcherArgs = new ClusterDispatcherArguments(args, conf)
@@ -76,10 +79,8 @@ object MesosClusterDispatcher {
7679
dispatcherArgs.webUiPort,
7780
conf,
7881
scheduler).start()
79-
this.synchronized {
80-
// block indefinitely
81-
this.wait() // TODO: bad
82-
}
82+
83+
shutdownLatch.await()
8384
}
8485

8586
class ClusterDispatcherArguments(args: Array[String], conf: SparkConf) {

0 commit comments

Comments
 (0)