diff options
author | Bryan Cutler <bjcutler@us.ibm.com> | 2015-05-04 18:29:22 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2015-05-04 18:30:02 -0700 |
commit | 48655d10ede9f286140ebe6d72be04b8ea9c3d85 (patch) | |
tree | 4c3dc8724002614d135aad4e832f1f4465c07d29 | |
parent | 1388a469b178486eac8645e155aa9c94bae6a181 (diff) | |
download | spark-48655d10ede9f286140ebe6d72be04b8ea9c3d85.tar.gz spark-48655d10ede9f286140ebe6d72be04b8ea9c3d85.tar.bz2 spark-48655d10ede9f286140ebe6d72be04b8ea9c3d85.zip |
[SPARK-7236] [CORE] Fix to prevent AkkaUtils askWithReply from sleeping on final attempt
Added a check so that if `AkkaUtils.askWithReply` is on the final attempt, it will not sleep for the `retryInterval`. This should also prevent the thread from sleeping for `Int.Max` when using `askWithReply` with default values for `maxAttempts` and `retryInterval`.
Author: Bryan Cutler <bjcutler@us.ibm.com>
Closes #5896 from BryanCutler/askWithReply-sleep-7236 and squashes the following commits:
653a07b [Bryan Cutler] [SPARK-7236] Fix to prevent AkkaUtils askWithReply from sleeping on final attempt
(cherry picked from commit 8aa5aea7fee0ae9cd34e16c30655ee02b8747455)
Signed-off-by: Reynold Xin <rxin@databricks.com>
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/AkkaUtils.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/AkkaUtils.scala b/core/src/main/scala/org/apache/spark/util/AkkaUtils.scala index b725df3b44..de3316d083 100644 --- a/core/src/main/scala/org/apache/spark/util/AkkaUtils.scala +++ b/core/src/main/scala/org/apache/spark/util/AkkaUtils.scala @@ -183,7 +183,9 @@ private[spark] object AkkaUtils extends Logging { lastException = e logWarning(s"Error sending message [message = $message] in $attempts attempts", e) } - Thread.sleep(retryInterval) + if (attempts < maxAttempts) { + Thread.sleep(retryInterval) + } } throw new SparkException( |