Fixed the failing doc test
This commit is contained in:
parent
9a7b9d7ab9
commit
c43b024cac
1 changed files with 11 additions and 5 deletions
|
|
@ -37,6 +37,12 @@ case class Message(s: String)
|
||||||
class FirstActor extends Actor {
|
class FirstActor extends Actor {
|
||||||
val myActor = context.actorOf(Props[MyActor], name = "myactor")
|
val myActor = context.actorOf(Props[MyActor], name = "myactor")
|
||||||
//#context-actorOf
|
//#context-actorOf
|
||||||
|
def receive = {
|
||||||
|
case x ⇒ sender ! x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AnonymousActor extends Actor {
|
||||||
//#anonymous-actor
|
//#anonymous-actor
|
||||||
def receive = {
|
def receive = {
|
||||||
case m: DoIt ⇒
|
case m: DoIt ⇒
|
||||||
|
|
@ -233,27 +239,27 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
||||||
system.stop(myActor)
|
system.stop(myActor)
|
||||||
}
|
}
|
||||||
|
|
||||||
"using implicit timeout" taggedAs TimingTest in {
|
"using implicit timeout" in {
|
||||||
val myActor = system.actorOf(Props(new FirstActor))
|
val myActor = system.actorOf(Props(new FirstActor))
|
||||||
//#using-implicit-timeout
|
//#using-implicit-timeout
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
import akka.util.Timeout
|
import akka.util.Timeout
|
||||||
import akka.pattern.ask
|
import akka.pattern.ask
|
||||||
implicit val timeout = Timeout(500 millis)
|
implicit val timeout = Timeout(5 seconds)
|
||||||
val future = myActor ? "hello"
|
val future = myActor ? "hello"
|
||||||
//#using-implicit-timeout
|
//#using-implicit-timeout
|
||||||
Await.result(future, timeout.duration) must be("hello")
|
Await.result(future, timeout.duration) must be("hello")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"using explicit timeout" taggedAs TimingTest in {
|
"using explicit timeout" in {
|
||||||
val myActor = system.actorOf(Props(new FirstActor))
|
val myActor = system.actorOf(Props(new FirstActor))
|
||||||
//#using-explicit-timeout
|
//#using-explicit-timeout
|
||||||
import akka.util.duration._
|
import akka.util.duration._
|
||||||
import akka.pattern.ask
|
import akka.pattern.ask
|
||||||
val future = myActor.ask("hello")(500 millis)
|
val future = myActor.ask("hello")(5 seconds)
|
||||||
//#using-explicit-timeout
|
//#using-explicit-timeout
|
||||||
Await.result(future, 500 millis) must be("hello")
|
Await.result(future, 5 seconds) must be("hello")
|
||||||
}
|
}
|
||||||
|
|
||||||
"using receiveTimeout" in {
|
"using receiveTimeout" in {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue