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(
55
55
private val maxCores = conf.getOption(" spark.cores.max" ).map(_.toInt)
56
56
private val totalExpectedCores = maxCores.getOrElse(0 )
57
57
58
+ /** Lock for `stop(finalState: SparkAppHandle.State)` method. */
59
+ private val stopLock = new Object
60
+
58
61
override def start () {
59
62
super .start()
60
63
launcherBackend.connect()
@@ -112,7 +115,7 @@ private[spark] class StandaloneSchedulerBackend(
112
115
launcherBackend.setState(SparkAppHandle .State .RUNNING )
113
116
}
114
117
115
- override def stop (): Unit = synchronized {
118
+ override def stop (): Unit = {
116
119
stop(SparkAppHandle .State .FINISHED )
117
120
}
118
121
@@ -206,7 +209,7 @@ private[spark] class StandaloneSchedulerBackend(
206
209
registrationBarrier.release()
207
210
}
208
211
209
- private def stop (finalState : SparkAppHandle .State ): Unit = synchronized {
212
+ private def stop (finalState : SparkAppHandle .State ): Unit = stopLock. synchronized {
210
213
try {
211
214
stopping = true
212
215
You can’t perform that action at this time.
0 commit comments