From b05d449a454add8a45c53c31fae0777a3503f0ea Mon Sep 17 00:00:00 2001 From: Bryan Cutler Date: Tue, 23 Jun 2015 16:31:54 -0700 Subject: [PATCH] [SPARK-6980] Changed constructor to use val duration instead of getter function, changed name of string property from conf to timeoutProp for consistency --- core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala | 11 ++++------- .../test/scala/org/apache/spark/rpc/RpcEnvSuite.scala | 2 +- 2 files changed, 5 insertions(+), 8 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 e0de3972ffe04..3b21e4e53dd08 100644 --- a/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala +++ b/core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala @@ -196,17 +196,14 @@ private[rpc] class RpcTimeoutException(message: String, cause: TimeoutException) /** * Associates a timeout with a description so that a when a TimeoutException occurs, additional * context about the timeout can be amended to the exception message. - * @param timeout timeout duration in seconds - * @param conf the configuration parameter that controls this timeout + * @param duration timeout duration in seconds + * @param timeoutProp the configuration property that controls this timeout */ -private[spark] class RpcTimeout(timeout: FiniteDuration, val conf: String) { - - /** Get the timeout duration */ - def duration: FiniteDuration = timeout +private[spark] class RpcTimeout(val duration: FiniteDuration, val timeoutProp: String) { /** Amends the standard message of TimeoutException to include the description */ private def createRpcTimeoutException(te: TimeoutException): RpcTimeoutException = { - new RpcTimeoutException(te.getMessage() + ". This timeout is controlled by " + conf, te) + new RpcTimeoutException(te.getMessage() + ". This timeout is controlled by " + timeoutProp, te) } /** diff --git a/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala b/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala index 4087a7fb5bcc6..a7d1839788eb1 100644 --- a/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala +++ b/core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala @@ -567,7 +567,7 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll { val defaultDurationSeconds = 1 val rt3 = RpcTimeout(conf, Seq(defaultProp), defaultDurationSeconds.toString + "s") assert( defaultDurationSeconds === rt3.duration.toSeconds ) - assert( rt3.conf.contains(defaultProp) ) + assert( rt3.timeoutProp.contains(defaultProp) ) // Try to construct RpcTimeout with an unconfigured property intercept[Throwable] {