In the code for Building the Basic Hierarchy section, shouldn't there be a context.actorOf instead of just actorOf? Same thing occurs a couple more times on page 198 and 199 in startPeople(). Am I missing something?
def startControls() { val controls = actorOf(Props(new IsolatedResumeSupervisor with OneForOneStrategyFactory { def childStarter() { val alt = context.actorOf(Props(newAltimeter), "Altimeter") context.actorOf(Props(newAutopilot), "AutoPilot") context.actorOf(Props(new ControlSurfaces(alt)), "ControlSurfaces") } }), "Controls") Await.result(controls ? WaitForStart, 1.second) }
One other issue in that same code fragment - and maybe it is another import issue. The one line with:
Await.result(controls ? WaitForStart, 1.second)
does not compile, with these errors:
not enough arguments for method seconds: (implicit ev: scala.concurrent.duration.DurationConversions.Classifier[Any])ev.R. Unspecified value parameter ev. Plane.scala
could not find implicit value for parameter ev: scala.concurrent.duration.DurationConversions.Classifier[Any] Plane.scala
If I split it up a bit and provide implicit timeout it compiles fine as follows:
implicit val timeout: Timeout = 1 seconds val future = controls ? WaitForStart Await.result(future, 1.second)
I don't think you're missing anything here either. The ask pattern is going to need that implicit timeout, which should be defined as an implicit in the Plane (again, it's in the code, but not code that is included in the book).
But, not all of the change you've made is necessary; the following would work:
class Plane ... { implicit val askTimeout: Timeout = 1.second