@@ -576,19 +576,14 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
576576 }
577577
578578 test(" ask a message timeout on Future using RpcTimeout" ) {
579- case class SleepyReply (msg : String )
579+ case class NeverReply (msg : String )
580580
581581 val rpcEndpointRef = env.setupEndpoint(" ask-future" , new RpcEndpoint {
582582 override val rpcEnv = env
583583
584584 override def receiveAndReply (context : RpcCallContext ): PartialFunction [Any , Unit ] = {
585- case msg : String => {
586- context.reply(msg)
587- }
588- case sr : SleepyReply => {
589- Thread .sleep(50 )
590- context.reply(sr.msg)
591- }
585+ case msg : String => context.reply(msg)
586+ case _ : NeverReply =>
592587 }
593588 })
594589
@@ -601,7 +596,7 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
601596 assert(" hello" === reply1)
602597
603598 // Ask with a delayed response and wait for response immediately that should timeout
604- val fut2 = rpcEndpointRef.ask[String ](SleepyReply (" doh" ), shortTimeout)
599+ val fut2 = rpcEndpointRef.ask[String ](NeverReply (" doh" ), shortTimeout)
605600 val reply2 =
606601 intercept[RpcTimeoutException ] {
607602 shortTimeout.awaitResult(fut2)
@@ -611,7 +606,7 @@ abstract class RpcEnvSuite extends SparkFunSuite with BeforeAndAfterAll {
611606 assert(reply2.contains(shortTimeout.timeoutProp))
612607
613608 // Ask with delayed response and allow the Future to timeout before Await.result
614- val fut3 = rpcEndpointRef.ask[String ](SleepyReply (" goodbye" ), shortTimeout)
609+ val fut3 = rpcEndpointRef.ask[String ](NeverReply (" goodbye" ), shortTimeout)
615610
616611 // Allow future to complete with failure using plain Await.result, this will return
617612 // once the future is complete to verify addMessageIfTimeout was invoked
0 commit comments