Removing ActorTimeoutException since it was only used in GracefulStop, and changed GracefulStop to use PromiseActorRef instead of spawning a toplevel actor

This commit is contained in:
Viktor Klang 2012-05-18 14:55:38 +02:00
parent 5eba9fceef
commit 5afe6601ff
4 changed files with 18 additions and 38 deletions

View file

@ -7,11 +7,9 @@ package akka.pattern
import akka.testkit.AkkaSpec
import akka.actor.Props
import akka.actor.Actor
import akka.actor.ActorTimeoutException
import akka.util.Duration
import akka.util.duration._
import akka.dispatch.{ Future, Promise, Await }
import java.lang.IllegalStateException
object PatternSpec {
case class Work(duration: Duration)
@ -41,13 +39,10 @@ class PatternSpec extends AkkaSpec {
Await.ready(gracefulStop(target, 1 millis), 1 second)
}
"complete Future with ActorTimeoutException when actor not terminated within timeout" in {
"complete Future with AskTimeoutException when actor not terminated within timeout" in {
val target = system.actorOf(Props[TargetActor])
target ! Work(250 millis)
val result = gracefulStop(target, 10 millis)
intercept[ActorTimeoutException] {
Await.result(result, 200 millis)
}
intercept[AskTimeoutException] { Await.result(gracefulStop(target, 10 millis), 200 millis) }
}
}