Skip to content
Snippets Groups Projects
Commit 5f569801 authored by jayadevanmurali's avatar jayadevanmurali Committed by Sean Owen
Browse files

[SPARK-11137][STREAMING] Make StreamingContext.stop() exception-safe

Make StreamingContext.stop() exception-safe

Author: jayadevanmurali <jayadevan.m@tcs.com>

Closes #10807 from jayadevanmurali/branch-0.1-SPARK-11137.
parent aca2a016
No related branches found
No related tags found
No related merge requests found
......@@ -693,12 +693,20 @@ class StreamingContext private[streaming] (
// interrupted. See SPARK-12001 for more details. Because the body of this case can be
// executed twice in the case of a partial stop, all methods called here need to be
// idempotent.
scheduler.stop(stopGracefully)
Utils.tryLogNonFatalError {
scheduler.stop(stopGracefully)
}
// Removing the streamingSource to de-register the metrics on stop()
env.metricsSystem.removeSource(streamingSource)
uiTab.foreach(_.detach())
Utils.tryLogNonFatalError {
env.metricsSystem.removeSource(streamingSource)
}
Utils.tryLogNonFatalError {
uiTab.foreach(_.detach())
}
StreamingContext.setActiveContext(null)
waiter.notifyStop()
Utils.tryLogNonFatalError {
waiter.notifyStop()
}
if (shutdownHookRef != null) {
shutdownHookRefToRemove = shutdownHookRef
shutdownHookRef = null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment