Cake Pattern

Worker.scala

master = context.actorSelection(Master.toAkkaUrl(activeMasterUrl))

ActorRefProvider.scala

trait ActorRefFactory {
def actorSelection(path: String): ActorSelection = path match {
  case RelativeActorPath(elems) ⇒
    if (elems.isEmpty) ActorSelection(provider.deadLetters, "")
    else if (elems.head.isEmpty) ActorSelection(provider.rootGuardian, elems.tail)
    else ActorSelection(lookupRoot, elems)
  case ActorPathExtractor(address, elems) ⇒
    ActorSelection(provider.rootGuardianAt(address), elems)
  case _ ⇒
    ActorSelection(provider.deadLetters, "")
}
...

参见

results matching ""

    No results matching ""