From 4be3a8d70fb8dd1b4aa864cd0d9a38bb8dbee5ce Mon Sep 17 00:00:00 2001 From: Harsh Gupta Date: Sun, 24 May 2015 12:25:32 +0530 Subject: [PATCH] Modifying loop condition to find property match --- core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala index f2d849786fdbf..48e315249ffa6 100644 --- a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala +++ b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala @@ -265,15 +265,16 @@ object RpcTimeout { // Find the first set property or use the default value with the first property val itr = timeoutPropList.iterator - var foundProp = (timeoutPropList.head,defaultValue) - while (itr.hasNext && (foundProp == (timeoutPropList.head,defaultValue))){ + var foundProp = None: Option[(String, String)] + while (itr.hasNext && foundProp.isEmpty){ val propKey = itr.next() conf.getOption(propKey) match { - case Some(prop) => foundProp = (propKey,prop) + case Some(prop) => foundProp = Some(propKey,prop) case None => } } - val timeout = { Utils.timeStringAsSeconds(foundProp._2) seconds } - new RpcTimeout(timeout, messagePrefix + foundProp._1) + val finalProp = foundProp.getOrElse(timeoutPropList.head, defaultValue) + val timeout = { Utils.timeStringAsSeconds(finalProp._2) seconds } + new RpcTimeout(timeout, messagePrefix + finalProp._1) } }