Skip to content

Commit

Permalink
Small fix to shutdown code.
Browse files Browse the repository at this point in the history
Avoid an interrupted exception when shutting down from the
reporter thread. Also, make extra effort to finish the RM
connection.
  • Loading branch information
Marcelo Vanzin committed Aug 19, 2014
1 parent f02d3f8 commit ecaf332
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ private[spark] class ApplicationMaster(args: ApplicationMasterArguments,
Option(diagnostics).map(msg => s" (diag message: $msg)").getOrElse(""))
finished = true
reporterThread.interrupt()
reporterThread.join()
client.shutdown(status, diagnostics)
try {
if (Thread.currentThread() != reporterThread) {
reporterThread.join()
}
} finally {
client.shutdown(status, diagnostics)
}
}
}

Expand Down

0 comments on commit ecaf332

Please sign in to comment.