diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-04-27 15:26:41 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-04-27 20:55:50 -0700 |
commit | 06f83cc1de78aaf56942404fb24aca81d1b66d2e (patch) | |
tree | 96a6ec8b315a9a6b98601131e45b139cd757caa7 | |
parent | 37575115b98fdc9ebadb2ebcbcd9907a3af1076c (diff) | |
download | spark-SPARK-10001-hotfix.tar.gz spark-SPARK-10001-hotfix.tar.bz2 spark-SPARK-10001-hotfix.zip |
Evaluate all actions in signal handlers (don't short-circuit)SPARK-10001-hotfix
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/SignalUtils.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/SignalUtils.scala b/core/src/main/scala/org/apache/spark/util/SignalUtils.scala index 9479d8f74d..5a24965170 100644 --- a/core/src/main/scala/org/apache/spark/util/SignalUtils.scala +++ b/core/src/main/scala/org/apache/spark/util/SignalUtils.scala @@ -92,9 +92,11 @@ private[spark] object SignalUtils extends Logging { // register old handler, will receive incoming signals while this handler is running Signal.handle(signal, prevHandler) - // run all actions, escalate to parent handler if no action catches the signal - // (i.e. all actions return false) - val escalate = actions.asScala.forall { action => !action() } + // Run all actions, escalate to parent handler if no action catches the signal + // (i.e. all actions return false). Note that calling `map` is to ensure that + // all actions are run, `forall` is short-circuited and will stop evaluating + // after reaching a first false predicate. + val escalate = actions.asScala.map(action => action()).forall(_ == false) if (escalate) { prevHandler.handle(sig) } |