[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 8aa5aea7fe)
Signed-off-by: Reynold Xin <rxin@databricks.com>
This commit is contained in:
Bryan Cutler 2015-05-04 18:29:22 -07:00 committed by Reynold Xin
parent 1388a469b1
commit 48655d10ed

View file

@ -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(