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
[[syntax trees at end of cleanup]]// Scala source: app.scala | |
package <empty> { | |
@serializable final case class PingObject extends java.lang.Object with ScalaObject with Product { | |
def productIterator(): Iterator = scala.Product$class.productIterator(PingObject.this); | |
@deprecated("use productIterator instead") def productElements(): Iterator = scala.Product$class.productElements(PingObject.this); | |
final override def toString(): java.lang.String = "PingObject"; | |
override def productPrefix(): java.lang.String = "PingObject"; | |
override def productArity(): Int = 0; | |
override def productElement(x$1: Int): java.lang.Object = { | |
<synthetic> val temp1: Int = x$1; |
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
sealed trait Base[T] { | |
val s: Option[String] | |
def copy(s: Option[String]) : T | |
} | |
case class CaseClass(override val s: Option[String] = None) extends Base[CaseClass] { | |
override def copy(s: Option[String]) = CaseClass(s) | |
} | |
def method[T <: Base[T]](base : Base[T]): T = { |
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
class SimpleActor extends Actor { | |
def receive = { | |
case message: String => | |
log.info("STARTED: %s @ %s" format(message, self.uuid)) | |
Thread.sleep(3000) | |
self.reply_?("[%s] received %s" format(self.uuid, message)) | |
log.info("FINISHED: %s @ %s" format(message, self.uuid)) | |
} | |
} |
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
class SimpleActor extends Actor { | |
def receive = { | |
case message: String => | |
log.info("STARTED: %s @ %s" format(message, self.uuid)) | |
Thread.sleep(3000) | |
self.reply_?("[%s] received %s" format(self.uuid, message)) | |
log.info("FINISHED: %s @ %s" format(message, self.uuid)) | |
} | |
} |
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
/** | |
* Registers reference to the actor (RemoteActorRef) at remote registry, | |
* so that the reference can be picked from the registry just like the other | |
* local actors | |
*/ | |
case class RegisterActor(actor: ActorLink) | |
/** | |
* Unregisters reference to the actor from remote registry | |
*/ | |
case class UnregisterActor(actor: ActorLink) |
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
/** | |
* Adds registry actor to the list of links on a remote node | |
*/ | |
case class AddRegistryLink(link: RegistryLink) | |
/** | |
* Removes registry actor from the list of links on a remote node | |
*/ | |
case class RemoveRegistryLink(link: RegistryLink) |
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
neighbour { # One of the hosts in the group that has a started RegistryActor | |
hostname = "localhost" | |
port = 9999 | |
} |
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
case RegisterActor(actor) => | |
log.debug("Registering remote actor [%s]" format(actor)) | |
if(!isActorInRegistry(actor.uuid) && !isLinkToLocal(actor)) | |
ActorRegistry.register( // Hack for 0.10, 1.0-M1 | |
RemoteClient.actorFor(actor.uuid.toString, actor.className, actor.hostname, actor.port) | |
) // RemoteActorRefs will register themselves in 1.0-M1+ | |
case UnregisterActor(actor) => { | |
log.debug("Unregistering remote actor [%s]" format(actor)) | |
ActorRegistry.foreach{act => |
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
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) |
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) = { |
OlderNewer