Skip to content

Commit

Permalink
[SPARK-6980] Changed constructor to use val duration instead of gette…
Browse files Browse the repository at this point in the history
…r function, changed name of string property from conf to timeoutProp for consistency
  • Loading branch information
BryanCutler committed Jun 23, 2015
1 parent c6cfd33 commit b05d449
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions core/src/main/scala/org/apache/spark/rpc/RpcEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala/org/apache/spark/rpc/RpcEnvSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down

0 comments on commit b05d449

Please sign in to comment.