Take a look at the code snippet:
import scala.actors.Actor._
object ActorTest1 extends Application {
val caller = self
val badActor = actor {
receive {
case msg =>
println(Thread.currentThread()+ " "+msg)
caller ! "bbbb"
}
}
badActor ! "aaaa"
receive {
case a: String => println(Thread.currentThread() + " " + a)
}
}
After badActor resonse "bbbb" to the sender, the whole application block . but if I change caller ! "bbbb"
to sender ! "bbbb"
, it will work.
Could anyone explain why ?