Created
November 23, 2010 21:13
-
-
Save remeniuk/712544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Publishes all local actors as remote references to the linked registry | |
* when the registry link is added | |
*/ | |
trait StartupActorRefsDistribution extends RegistryActor{ | |
/** | |
* Adds link to remote registry, and register all local actors at there | |
*/ | |
protected override def addRegistryLink(link: RegistryLink) = { | |
super.addRegistryLink(link) | |
registerActorsAt(linkedRegistries.get(link)) | |
} | |
/** | |
* Registers all local actors at the remote node | |
*/ | |
private def registerActorsAt(remoteRegistry: ActorRef) = { | |
ActorRegistry.filter(actor => | |
actor.id == REGISTRY_ACTOR && isActorLocal(actor)) | |
.foreach{actor => remoteRegistry ! RegisterActor(actor)} | |
remoteRegistry | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment