请查看以下代码,并解释在akka actor系统中产生演员的不同方式之间的区别。这是有效的,为什么?
Class Parent extends Actor{
def createChild(props:Props,name:String)={
context.actorOf(props,name)
}
val type1=createChild(ChildActor.props,"Child")
lazy val type2=createChild(ChildActor.props,"Child")
def receive={
case x =>
type1 !"someMessage"
type2 ! "someMessage"
createChild(ChildActor.props,"Child") ! "someMessage
}
}
提前致谢