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 71924475826d9..c8aab1e1ab405 100644 --- a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala +++ b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala @@ -264,9 +264,15 @@ object RpcTimeout { require(timeoutPropList.nonEmpty) // Find the first set property or use the default value with the first property - val foundProp = timeoutPropList.view.map(x => (x, conf.getOption(x))).filter(_._2.isDefined). - map(y => (y._1, y._2.get)).headOption.getOrElse(timeoutPropList.head, defaultValue) - + val itr = timeoutPropList.iterator + var foundProp = (timeoutPropList.head,defaultValue) + while (itr.hasNext){ + val propKey = itr.next() + conf.getOption(propKey) match { + case Some(prop) => foundProp = (propKey,prop) + case None => + } + } val timeout = { Utils.timeStringAsSeconds(foundProp._2) seconds } new RpcTimeout(timeout, messagePrefix + foundProp._1) }