Skip to content

Instantly share code, notes, and snippets.

@remeniuk
Created November 23, 2010 21:11
Show Gist options
  • Save remeniuk/712539 to your computer and use it in GitHub Desktop.
Save remeniuk/712539 to your computer and use it in GitHub Desktop.
case AddRegistryLink(link) =>
if(!linkedRegistries.containsKey(link))
addRegistryLink(link)
else
log.debug("Link to registry [%s] is already present" format(link))
case RemoveRegistryLink(link) => {
log.debug("Unlinking from registry [%s]" format(link))
linkedRegistries.remove(link)
}
...
/**
* Adds link to remote registry, and register all local actors at there
*/
protected def addRegistryLink(link: RegistryLink) = {
log.debug("Adding link to remote registry [%s]" format(link))
val remoteRegistry = RemoteClient.actorFor(link.name.toString, link.host, link.port)
log.debug("Letting remote registry know about the other linked registries...")
val iterator = linkedRegistries.keySet.iterator
while(iterator.hasNext) remoteRegistry ! iterator.next
remoteRegistry ! AddRegistryLink(RegistryLink())
linkedRegistries.put(link, remoteRegistry)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment