=act #3800: Add timeout value in AskTimeoutException message.

This commit is contained in:
Gaetan Hervouet 2013-12-18 17:30:19 -05:00
parent e25455e935
commit 4c2eb74c78
2 changed files with 9 additions and 1 deletions

View file

@ -76,6 +76,14 @@ class AskSpec extends AkkaSpec {
}.getMessage.contains("/user/silent") should be(true) }.getMessage.contains("/user/silent") should be(true)
} }
"include timeout information in AskTimeout" in {
implicit val timeout = Timeout(0.5 seconds)
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
Await.result(f, remaining)
}.getMessage should include(timeout.duration.toMillis.toString)
}
"work for ActorSelection" in { "work for ActorSelection" in {
implicit val timeout = Timeout(5 seconds) implicit val timeout = Timeout(5 seconds)
import system.dispatcher import system.dispatcher

View file

@ -330,7 +330,7 @@ private[akka] object PromiseActorRef {
val a = new PromiseActorRef(provider, result) val a = new PromiseActorRef(provider, result)
implicit val ec = a.internalCallingThreadExecutionContext implicit val ec = a.internalCallingThreadExecutionContext
val f = scheduler.scheduleOnce(timeout.duration) { val f = scheduler.scheduleOnce(timeout.duration) {
result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName]")) result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName] after [${timeout.duration.toMillis} ms]"))
} }
result.future onComplete { _ try a.stop() finally f.cancel() } result.future onComplete { _ try a.stop() finally f.cancel() }
a a