File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
core/src/main/scala/org/apache/spark/scheduler/cluster Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ private[spark] class StandaloneSchedulerBackend(
5555 private val maxCores = conf.getOption(" spark.cores.max" ).map(_.toInt)
5656 private val totalExpectedCores = maxCores.getOrElse(0 )
5757
58+ /** Lock for `stop(finalState: SparkAppHandle.State)` method. */
59+ private val stopLock = new Object
60+
5861 override def start () {
5962 super .start()
6063 launcherBackend.connect()
@@ -112,7 +115,7 @@ private[spark] class StandaloneSchedulerBackend(
112115 launcherBackend.setState(SparkAppHandle .State .RUNNING )
113116 }
114117
115- override def stop (): Unit = synchronized {
118+ override def stop (): Unit = {
116119 stop(SparkAppHandle .State .FINISHED )
117120 }
118121
@@ -206,7 +209,7 @@ private[spark] class StandaloneSchedulerBackend(
206209 registrationBarrier.release()
207210 }
208211
209- private def stop (finalState : SparkAppHandle .State ): Unit = synchronized {
212+ private def stop (finalState : SparkAppHandle .State ): Unit = stopLock. synchronized {
210213 try {
211214 stopping = true
212215
You can’t perform that action at this time.
0 commit comments