Skip to content

Commit b05d449

Browse files
committed
[SPARK-6980] Changed constructor to use val duration instead of getter function, changed name of string property from conf to timeoutProp for consistency
1 parent c6cfd33 commit b05d449

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,14 @@ private[rpc] class RpcTimeoutException(message: String, cause: TimeoutException)
196196
/**
197197
* Associates a timeout with a description so that a when a TimeoutException occurs, additional
198198
* context about the timeout can be amended to the exception message.
199-
* @param timeout timeout duration in seconds
200-
* @param conf the configuration parameter that controls this timeout
199+
* @param duration timeout duration in seconds
200+
* @param timeoutProp the configuration property that controls this timeout
201201
*/
202-
private[spark] class RpcTimeout(timeout: FiniteDuration, val conf: String) {
203-
204-
/** Get the timeout duration */
205-
def duration: FiniteDuration = timeout
202+
private[spark] class RpcTimeout(val duration: FiniteDuration, val timeoutProp: String) {
206203

207204
/** Amends the standard message of TimeoutException to include the description */
208205
private def createRpcTimeoutException(te: TimeoutException): RpcTimeoutException = {
209-
new RpcTimeoutException(te.getMessage() + ". This timeout is controlled by " + conf, te)
206+
new RpcTimeoutException(te.getMessage() + ". This timeout is controlled by " + timeoutProp, te)
210207
}
211208

212209
/**

core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
567567
val defaultDurationSeconds = 1
568568
val rt3 = RpcTimeout(conf, Seq(defaultProp), defaultDurationSeconds.toString + "s")
569569
assert( defaultDurationSeconds === rt3.duration.toSeconds )
570-
assert( rt3.conf.contains(defaultProp) )
570+
assert( rt3.timeoutProp.contains(defaultProp) )
571571

572572
// Try to construct RpcTimeout with an unconfigured property
573573
intercept[Throwable] {

0 commit comments

Comments
 (0)