The Artima Developer Community
Sponsored Link

Akka Concurrency Forum
Ch 9.4, why two setCourse

1 reply on 1 page. Most recent reply: Jul 26, 2013 6:58 AM by Derek Wyatt

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Chifeng Chou

Posts: 2
Nickname: cfchou
Registered: Jul, 2013

Ch 9.4, why two setCourse Posted: Jul 25, 2013 5:47 AM
Reply to this message Reply
Advertisement
Hi,

Firstly I wanted to thank Derek for writing this nice book. The examples used in this book are fun and clear.

Now I have a question with respect to Ch 9.4(p.251 in the printed book) where it explains the reason why there are two setCourse is FlyingBehaviour only accepts Fly message in the Flying state. I'm a bit confused about this. I suspect that it meant Idle state, since FlyingBehaviour can fall back to Idle in many situations so we need to send Fly message again i.e.

override def unhandled(msg: Any): Unit = {
msg match {
case Transation(_, _, Flying) =>
// ???
// setCourse(sender)
case Transation(_, _, Idle) =>
setCourse(sender)
...
}
}


Derek Wyatt

Posts: 69
Nickname: dwyatt
Registered: Oct, 2012

Re: Ch 9.4, why two setCourse Posted: Jul 26, 2013 6:58 AM
Reply to this message Reply
Hi Chifeng,

I think you're right. I'll have to take a closer look, but based on what I can see at the moment, it looks like I've got the code in the wrong spot.

Either way, I think you've got the idea, even more so if you've found a bug :)

Thanks!
Derek

Flat View: This topic has 1 reply on 1 page
Topic: ImplicitSender Previous Topic   Next Topic Topic: ePub format

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use