File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
streaming/src/main/scala/org/apache/spark/streaming Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -492,10 +492,6 @@ class StreamingContext private[streaming] (
492492 * received data to be completed
493493 */
494494 def stop (stopSparkContext : Boolean , stopGracefully : Boolean ): Unit = synchronized {
495- // Even if the streaming context has not been started, we still need to stop the SparkContext.
496- // Even if we have already stopped, we still need to attempt to stop the SparkContext because
497- // a user might stop(stopSparkContext = false) and then call stop(stopSparkContext = true).
498- if (stopSparkContext) sc.stop()
499495 if (state == Stopped ) {
500496 logWarning(" StreamingContext has already been stopped" )
501497 } else {
@@ -507,6 +503,10 @@ class StreamingContext private[streaming] (
507503 waiter.notifyStop()
508504 }
509505 }
506+ // Even if the streaming context has not been started, we still need to stop the SparkContext.
507+ // Even if we have already stopped, we still need to attempt to stop the SparkContext because
508+ // a user might stop(stopSparkContext = false) and then call stop(stopSparkContext = true).
509+ if (stopSparkContext) sc.stop()
510510 // The state should always be Stopped after calling `stop()`, even if we haven't started yet:
511511 state = Stopped
512512 }
You can’t perform that action at this time.
0 commit comments