diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index a557e11877..6029a700f0 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -441,23 +441,3 @@ trait Actor { private val processingBehavior = receive //ProcessingBehavior is the original behavior } -/** - * Helper methods and fields for working with actor addresses. - * Meant for internal use. - * - * @author Jonas Bonér - */ -object Address { - - val clusterActorRefPrefix = "cluster-actor-ref.".intern - - private val validAddressPattern = java.util.regex.Pattern.compile("[0-9a-zA-Z\\-\\_\\$\\.]+") - - def validate(address: String) { - if (!validAddressPattern.matcher(address).matches) { - val e = new IllegalArgumentException("Address [" + address + "] is not valid, need to follow pattern: " + validAddressPattern.pattern) - throw e - } - } -} - diff --git a/akka-actor/src/main/scala/akka/actor/ActorCell.scala b/akka-actor/src/main/scala/akka/actor/ActorCell.scala index 7e1e5e5aca..f16a9867c8 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorCell.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorCell.scala @@ -220,7 +220,7 @@ private[akka] class ActorCell( def terminate() { receiveTimeout = None cancelReceiveTimeout - app.provider.evict(self.address) + app.provider.evict(self.path.toString) dispatcher.detach(this) try { diff --git a/akka-actor/src/main/scala/akka/actor/ActorPath.scala b/akka-actor/src/main/scala/akka/actor/ActorPath.scala index 062793dcdf..460b71a28d 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorPath.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorPath.scala @@ -9,6 +9,8 @@ import akka.AkkaApplication object ActorPath { final val separator = "/" + val pattern = """(/[0-9a-zA-Z\-\_\$\.]+)+""".r.pattern + /** * Create an actor path from a string. */ @@ -35,6 +37,21 @@ object ActorPath { */ def join(path: Iterable[String]): String = path.mkString(separator, separator, "") + + /** + * Is this string representation of a path valid? + */ + def valid(path: String): Boolean = + pattern.matcher(path).matches + + /** + * Validate a path. Moved here from Address.validate. + * Throws an IllegalArgumentException if the path is invalid. + */ + def validate(path: String): Unit = { + if (!valid(path)) + throw new IllegalArgumentException("Path [" + path + "] is not valid. Needs to follow this pattern: " + pattern) + } } /** diff --git a/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala b/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala index f262c3b8f1..b0291783cb 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala @@ -65,7 +65,7 @@ trait ActorRefFactory { */ protected def guardian: ActorRef - def actorOf(props: Props): ActorRef = actorOf(props, Props.randomAddress) + def actorOf(props: Props): ActorRef = actorOf(props, Props.randomName) /* * TODO this will have to go at some point, because creating two actors with @@ -85,7 +85,7 @@ trait ActorRefFactory { def actorOf(creator: UntypedActorFactory): ActorRef = actorOf(Props(() ⇒ creator.create())) - def actorOf(props: RoutedProps): ActorRef = actorOf(props, Props.randomAddress) + def actorOf(props: RoutedProps): ActorRef = actorOf(props, Props.randomName) def actorOf(props: RoutedProps, name: String): ActorRef = provider.actorOf(props, guardian, name) @@ -178,7 +178,7 @@ class LocalActorRefProvider(val app: AkkaApplication) extends ActorRefProvider { private[akka] def actorOf(props: Props, supervisor: ActorRef, path: ActorPath, systemService: Boolean): ActorRef = { val name = path.name - if ((name eq null) || name == Props.randomAddress) { + if ((name eq null) || name == Props.randomName) { val randomName: String = newUuid.toString val newPath = path.parent / randomName val actor = new LocalActorRef(app, props, supervisor, newPath, systemService = true) diff --git a/akka-actor/src/main/scala/akka/actor/Deployer.scala b/akka-actor/src/main/scala/akka/actor/Deployer.scala index cb8dfd04eb..30d746a054 100644 --- a/akka-actor/src/main/scala/akka/actor/Deployer.scala +++ b/akka-actor/src/main/scala/akka/actor/Deployer.scala @@ -21,8 +21,8 @@ trait ActorDeployer { private[akka] def deploy(deployment: Deploy): Unit private[akka] def lookupDeploymentFor(address: String): Option[Deploy] def lookupDeployment(address: String): Option[Deploy] = address match { - case null | Props.`randomAddress` ⇒ None - case some ⇒ lookupDeploymentFor(some) + case null | Props.`randomName` ⇒ None + case some ⇒ lookupDeploymentFor(some) } private[akka] def deploy(deployment: Seq[Deploy]): Unit = deployment foreach (deploy(_)) } diff --git a/akka-actor/src/main/scala/akka/actor/Props.scala b/akka-actor/src/main/scala/akka/actor/Props.scala index c6732b6eca..a42ff45f6e 100644 --- a/akka-actor/src/main/scala/akka/actor/Props.scala +++ b/akka-actor/src/main/scala/akka/actor/Props.scala @@ -30,7 +30,7 @@ object Props { final val defaultFaultHandler: FaultHandlingStrategy = OneForOneStrategy(defaultDecider, None, None) final val noHotSwap: Stack[Actor.Receive] = Stack.empty - final val randomAddress: String = "" + final val randomName: String = "" /** * The default Props instance, uses the settings from the Props object starting with default* diff --git a/akka-actor/src/main/scala/akka/actor/TypedActor.scala b/akka-actor/src/main/scala/akka/actor/TypedActor.scala index 2974808efc..551cf15c86 100644 --- a/akka-actor/src/main/scala/akka/actor/TypedActor.scala +++ b/akka-actor/src/main/scala/akka/actor/TypedActor.scala @@ -130,15 +130,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒ * all interfaces (Class.getInterfaces) if it's not an interface class */ def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props): R = - typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomAddress, interface.getClassLoader) + typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomName, interface.getClassLoader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * all interfaces (Class.getInterfaces) if it's not an interface class */ - def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, address: String): R = - typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, address, interface.getClassLoader) + def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, name: String): R = + typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, name, interface.getClassLoader) /** * Creates a new TypedActor proxy using the supplied Props, @@ -146,15 +146,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒ * all interfaces (Class.getInterfaces) if it's not an interface class */ def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props): R = - typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomAddress, interface.getClassLoader) + typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomName, interface.getClassLoader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * all interfaces (Class.getInterfaces) if it's not an interface class */ - def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, address: String): R = - typedActor.createProxyAndTypedActor(this, interface, impl.create, props, address, interface.getClassLoader) + def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, name: String): R = + typedActor.createProxyAndTypedActor(this, interface, impl.create, props, name, interface.getClassLoader) /** * Creates a new TypedActor proxy using the supplied Props, @@ -162,15 +162,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒ * all interfaces (Class.getInterfaces) if it's not an interface class */ def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomAddress, loader) + typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomName, loader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * all interfaces (Class.getInterfaces) if it's not an interface class */ - def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, address: String, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, address, loader) + def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, name: String, loader: ClassLoader): R = + typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, name, loader) /** * Creates a new TypedActor proxy using the supplied Props, @@ -178,73 +178,73 @@ trait TypedActorFactory { this: ActorRefFactory ⇒ * all interfaces (Class.getInterfaces) if it's not an interface class */ def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomAddress, loader) + typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomName, loader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * all interfaces (Class.getInterfaces) if it's not an interface class */ - def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, address: String, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, interface, impl.create, props, address, loader) + def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, name: String, loader: ClassLoader): R = + typedActor.createProxyAndTypedActor(this, interface, impl.create, props, name, loader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) */ def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, Props.randomAddress, loader) + typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, Props.randomName, loader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) */ - def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, address: String, loader: ClassLoader): R = - typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, address, loader) + def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, name: String, loader: ClassLoader): R = + typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, name, loader) /** * Creates a new TypedActor proxy using the supplied Props, * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) */ - def typedActorOf[R <: AnyRef, T <: R](props: Props = Props(), address: String = Props.randomAddress, loader: ClassLoader = null)(implicit m: Manifest[T]): R = { + def typedActorOf[R <: AnyRef, T <: R](props: Props = Props(), name: String = Props.randomName, loader: ClassLoader = null)(implicit m: Manifest[T]): R = { val clazz = m.erasure.asInstanceOf[Class[T]] - typedActor.createProxyAndTypedActor(this, clazz, clazz.newInstance, props, address, if (loader eq null) clazz.getClassLoader else loader) + typedActor.createProxyAndTypedActor(this, clazz, clazz.newInstance, props, name, if (loader eq null) clazz.getClassLoader else loader) } /** * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * to create TypedActor proxies, use typedActorOf */ - def createProxy[R <: AnyRef](constructor: ⇒ Actor, props: Props = Props(), address: String = Props.randomAddress, loader: ClassLoader = null)(implicit m: Manifest[R]): R = - typedActor.createProxy[R](this, typedActor.extractInterfaces(m.erasure), (ref: AtomVar[R]) ⇒ constructor, props, Props.randomAddress, if (loader eq null) m.erasure.getClassLoader else loader) + def createProxy[R <: AnyRef](constructor: ⇒ Actor, props: Props = Props(), name: String = Props.randomName, loader: ClassLoader = null)(implicit m: Manifest[R]): R = + typedActor.createProxy[R](this, typedActor.extractInterfaces(m.erasure), (ref: AtomVar[R]) ⇒ constructor, props, Props.randomName, if (loader eq null) m.erasure.getClassLoader else loader) /** * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * to create TypedActor proxies, use typedActorOf */ def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, loader: ClassLoader): R = - typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) ⇒ constructor.create, props, Props.randomAddress, loader) + typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) ⇒ constructor.create, props, Props.randomName, loader) /** * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * to create TypedActor proxies, use typedActorOf */ - def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, address: String, loader: ClassLoader): R = - typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) ⇒ constructor.create, props, address, loader) + def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, name: String, loader: ClassLoader): R = + typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) ⇒ constructor.create, props, name, loader) /** * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * to create TypedActor proxies, use typedActorOf */ def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: ⇒ Actor, props: Props, loader: ClassLoader): R = - typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) ⇒ constructor, props, Props.randomAddress, loader) + typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) ⇒ constructor, props, Props.randomName, loader) /** * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * to create TypedActor proxies, use typedActorOf */ - def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: ⇒ Actor, props: Props, address: String, loader: ClassLoader): R = - typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) ⇒ constructor, props, address, loader) + def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: ⇒ Actor, props: Props, name: String, loader: ClassLoader): R = + typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) ⇒ constructor, props, name, loader) } @@ -302,15 +302,15 @@ class TypedActor(val app: AkkaApplication) { } else null - private[akka] def createProxy[R <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], constructor: (AtomVar[R]) ⇒ Actor, props: Props, address: String, loader: ClassLoader): R = { + private[akka] def createProxy[R <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], constructor: (AtomVar[R]) ⇒ Actor, props: Props, name: String, loader: ClassLoader): R = { val proxyVar = new AtomVar[R] - configureAndProxyLocalActorRef[R](supervisor, interfaces, proxyVar, props.withCreator(constructor(proxyVar)), address, loader) + configureAndProxyLocalActorRef[R](supervisor, interfaces, proxyVar, props.withCreator(constructor(proxyVar)), name, loader) } - private[akka] def createProxyAndTypedActor[R <: AnyRef, T <: R](supervisor: ActorRefFactory, interface: Class[_], constructor: ⇒ T, props: Props, address: String, loader: ClassLoader): R = - createProxy[R](supervisor, extractInterfaces(interface), (ref: AtomVar[R]) ⇒ new TypedActor[R, T](ref, constructor), props, address, loader) + private[akka] def createProxyAndTypedActor[R <: AnyRef, T <: R](supervisor: ActorRefFactory, interface: Class[_], constructor: ⇒ T, props: Props, name: String, loader: ClassLoader): R = + createProxy[R](supervisor, extractInterfaces(interface), (ref: AtomVar[R]) ⇒ new TypedActor[R, T](ref, constructor), props, name, loader) - private[akka] def configureAndProxyLocalActorRef[T <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], proxyVar: AtomVar[T], props: Props, address: String, loader: ClassLoader): T = { + private[akka] def configureAndProxyLocalActorRef[T <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], proxyVar: AtomVar[T], props: Props, name: String, loader: ClassLoader): T = { //Warning, do not change order of the following statements, it's some elaborate chicken-n-egg handling val actorVar = new AtomVar[ActorRef](null) val timeout = props.timeout match { @@ -319,7 +319,7 @@ class TypedActor(val app: AkkaApplication) { } val proxy: T = Proxy.newProxyInstance(loader, interfaces, new TypedActorInvocationHandler(actorVar, timeout)).asInstanceOf[T] proxyVar.set(proxy) // Chicken and egg situation we needed to solve, set the proxy so that we can set the self-reference inside each receive - val ref = supervisor.actorOf(props, address) + val ref = supervisor.actorOf(props, name) actorVar.set(ref) //Make sure the InvocationHandler gets ahold of the actor reference, this is not a problem since the proxy hasn't escaped this method yet proxyVar.get } diff --git a/akka-actor/src/main/scala/akka/event/Logging.scala b/akka-actor/src/main/scala/akka/event/Logging.scala index 2cd1903948..47ca0f82d0 100644 --- a/akka-actor/src/main/scala/akka/event/Logging.scala +++ b/akka-actor/src/main/scala/akka/event/Logging.scala @@ -129,7 +129,7 @@ trait LoggingBus extends ActorEventBus { } private def addLogger(app: AkkaApplication, clazz: Class[_ <: Actor], level: LogLevel): ActorRef = { - val actor = app.systemActorOf(Props(clazz), Props.randomAddress) + val actor = app.systemActorOf(Props(clazz), Props.randomName) actor ! InitializeLogger(this) AllLogLevels filter (level >= _) foreach (l ⇒ subscribe(actor, classFor(l))) publish(Info(this, "logger " + clazz.getName + " started")) diff --git a/akka-camel-typed/src/main/scala/akka/camel/TypedCamel.scala b/akka-camel-typed/src/main/scala/akka/camel/TypedCamel.scala index 2e1d19817b..67499bb02b 100644 --- a/akka-camel-typed/src/main/scala/akka/camel/TypedCamel.scala +++ b/akka-camel-typed/src/main/scala/akka/camel/TypedCamel.scala @@ -32,8 +32,8 @@ private[camel] object TypedCamel { * and re-uses the activationTracker of service. */ def onCamelServiceStart(service: CamelService) { - consumerPublisher = new LocalActorRef(Props(new TypedConsumerPublisher(service.activationTracker)), Props.randomAddress, true) - publishRequestor = new LocalActorRef(Props(new TypedConsumerPublishRequestor), Props.randomAddress, true) + consumerPublisher = new LocalActorRef(Props(new TypedConsumerPublisher(service.activationTracker)), Props.randomName, true) + publishRequestor = new LocalActorRef(Props(new TypedConsumerPublishRequestor), Props.randomName, true) registerPublishRequestor diff --git a/akka-camel/src/main/scala/akka/camel/CamelService.scala b/akka-camel/src/main/scala/akka/camel/CamelService.scala index eeb039cb8d..643d18fb18 100644 --- a/akka-camel/src/main/scala/akka/camel/CamelService.scala +++ b/akka-camel/src/main/scala/akka/camel/CamelService.scala @@ -26,9 +26,9 @@ import TypedCamelAccess._ * @author Martin Krasser */ trait CamelService extends Bootable { - private[camel] val activationTracker = new LocalActorRef(Props[ActivationTracker], Props.randomAddress, true) - private[camel] val consumerPublisher = new LocalActorRef(Props(new ConsumerPublisher(activationTracker)), Props.randomAddress, true) - private[camel] val publishRequestor = new LocalActorRef(Props(new ConsumerPublishRequestor), Props.randomAddress, true) + private[camel] val activationTracker = new LocalActorRef(Props[ActivationTracker], Props.randomName, true) + private[camel] val consumerPublisher = new LocalActorRef(Props(new ConsumerPublisher(activationTracker)), Props.randomName, true) + private[camel] val publishRequestor = new LocalActorRef(Props(new ConsumerPublishRequestor), Props.randomName, true) private val serviceEnabled = config.getList("akka.enabled-modules").exists(_ == "camel") diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index 7227839c9a..274ac6e9dc 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -1860,7 +1860,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor { Props( self ⇒ { case f: Function0[_] ⇒ try { f() } finally { self.stop() } - }).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) + }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) } def handle_fun0_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { @@ -1868,7 +1868,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor { Props( self ⇒ { case f: Function0[_] ⇒ try { self.reply(f()) } finally { self.stop() } - }).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) + }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) } def handle_fun1_arg_unit(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { @@ -1876,7 +1876,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor { Props( self ⇒ { case (fun: Function[_, _], param: Any) ⇒ try { fun.asInstanceOf[Any ⇒ Unit].apply(param) } finally { self.stop() } - }).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) + }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) } def handle_fun1_arg_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { @@ -1884,7 +1884,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor { Props( self ⇒ { case (fun: Function[_, _], param: Any) ⇒ try { self.reply(fun.asInstanceOf[Any ⇒ Any](param)) } finally { self.stop() } - }).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) + }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) } def handleFailover(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala index e7f4f2c4b5..eb383658b8 100644 --- a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala +++ b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala @@ -31,7 +31,7 @@ abstract class DurableMailboxSpec(val backendName: String, val storage: DurableM "should handle reply to ! for 1 message" in { val latch = new CountDownLatch(1) val queueActor = createMailboxTestActor(backendName + " should handle reply to !") - val sender = new LocalActorRef(Props(self ⇒ { case "sum" ⇒ latch.countDown }), Props.randomAddress, true) + val sender = new LocalActorRef(Props(self ⇒ { case "sum" ⇒ latch.countDown }), Props.randomName, true) queueActor.!("sum")(Some(sender)) latch.await(10, TimeUnit.SECONDS) must be(true) @@ -40,7 +40,7 @@ abstract class DurableMailboxSpec(val backendName: String, val storage: DurableM "should handle reply to ! for multiple messages" in { val latch = new CountDownLatch(5) val queueActor = createMailboxTestActor(backendName + " should handle reply to !") - val sender = new LocalActorRef(Props(self ⇒ { case "sum" ⇒ latch.countDown }), Props.randomAddress, true) + val sender = new LocalActorRef(Props(self ⇒ { case "sum" ⇒ latch.countDown }), Props.randomName, true) for (i ← 1 to 5) queueActor.!("sum")(Some(sender)) diff --git a/akka-remote/src/main/java/akka/remote/RemoteProtocol.java b/akka-remote/src/main/java/akka/remote/RemoteProtocol.java index 89ee558709..abe7edf647 100644 --- a/akka-remote/src/main/java/akka/remote/RemoteProtocol.java +++ b/akka-remote/src/main/java/akka/remote/RemoteProtocol.java @@ -2711,17 +2711,17 @@ public final class RemoteProtocol { public interface ActorRefProtocolOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string address = 1; - boolean hasAddress(); - String getAddress(); - - // required string host = 2; + // required string host = 1; boolean hasHost(); String getHost(); - // required uint32 port = 3; + // required uint32 port = 2; boolean hasPort(); int getPort(); + + // required string path = 3; + boolean hasPath(); + String getPath(); } public static final class ActorRefProtocol extends com.google.protobuf.GeneratedMessage @@ -2752,43 +2752,11 @@ public final class RemoteProtocol { } private int bitField0_; - // required string address = 1; - public static final int ADDRESS_FIELD_NUMBER = 1; - private java.lang.Object address_; - public boolean hasAddress() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getAddress() { - java.lang.Object ref = address_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - address_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getAddressBytes() { - java.lang.Object ref = address_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - address_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required string host = 2; - public static final int HOST_FIELD_NUMBER = 2; + // required string host = 1; + public static final int HOST_FIELD_NUMBER = 1; private java.lang.Object host_; public boolean hasHost() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000001) == 0x00000001); } public String getHost() { java.lang.Object ref = host_; @@ -2816,30 +2784,58 @@ public final class RemoteProtocol { } } - // required uint32 port = 3; - public static final int PORT_FIELD_NUMBER = 3; + // required uint32 port = 2; + public static final int PORT_FIELD_NUMBER = 2; private int port_; public boolean hasPort() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000002) == 0x00000002); } public int getPort() { return port_; } + // required string path = 3; + public static final int PATH_FIELD_NUMBER = 3; + private java.lang.Object path_; + public boolean hasPath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { - address_ = ""; host_ = ""; port_ = 0; + path_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - if (!hasAddress()) { - memoizedIsInitialized = 0; - return false; - } if (!hasHost()) { memoizedIsInitialized = 0; return false; @@ -2848,6 +2844,10 @@ public final class RemoteProtocol { memoizedIsInitialized = 0; return false; } + if (!hasPath()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -2856,13 +2856,13 @@ public final class RemoteProtocol { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getAddressBytes()); + output.writeBytes(1, getHostBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getHostBytes()); + output.writeUInt32(2, port_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeUInt32(3, port_); + output.writeBytes(3, getPathBytes()); } getUnknownFields().writeTo(output); } @@ -2875,15 +2875,15 @@ public final class RemoteProtocol { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getAddressBytes()); + .computeBytesSize(1, getHostBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getHostBytes()); + .computeUInt32Size(2, port_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(3, port_); + .computeBytesSize(3, getPathBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -3009,11 +3009,11 @@ public final class RemoteProtocol { public Builder clear() { super.clear(); - address_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); host_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); + bitField0_ = (bitField0_ & ~0x00000001); port_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + path_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -3056,15 +3056,15 @@ public final class RemoteProtocol { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.address_ = address_; + result.host_ = host_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } - result.host_ = host_; + result.port_ = port_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } - result.port_ = port_; + result.path_ = path_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -3081,24 +3081,20 @@ public final class RemoteProtocol { public Builder mergeFrom(akka.remote.RemoteProtocol.ActorRefProtocol other) { if (other == akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) return this; - if (other.hasAddress()) { - setAddress(other.getAddress()); - } if (other.hasHost()) { setHost(other.getHost()); } if (other.hasPort()) { setPort(other.getPort()); } + if (other.hasPath()) { + setPath(other.getPath()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { - if (!hasAddress()) { - - return false; - } if (!hasHost()) { return false; @@ -3107,6 +3103,10 @@ public final class RemoteProtocol { return false; } + if (!hasPath()) { + + return false; + } return true; } @@ -3135,65 +3135,29 @@ public final class RemoteProtocol { } case 10: { bitField0_ |= 0x00000001; - address_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; host_ = input.readBytes(); break; } - case 24: { - bitField0_ |= 0x00000004; + case 16: { + bitField0_ |= 0x00000002; port_ = input.readUInt32(); break; } + case 26: { + bitField0_ |= 0x00000004; + path_ = input.readBytes(); + break; + } } } } private int bitField0_; - // required string address = 1; - private java.lang.Object address_ = ""; - public boolean hasAddress() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getAddress() { - java.lang.Object ref = address_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - address_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setAddress(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - address_ = value; - onChanged(); - return this; - } - public Builder clearAddress() { - bitField0_ = (bitField0_ & ~0x00000001); - address_ = getDefaultInstance().getAddress(); - onChanged(); - return this; - } - void setAddress(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - address_ = value; - onChanged(); - } - - // required string host = 2; + // required string host = 1; private java.lang.Object host_ = ""; public boolean hasHost() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000001) == 0x00000001); } public String getHost() { java.lang.Object ref = host_; @@ -3209,44 +3173,80 @@ public final class RemoteProtocol { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000001; host_ = value; onChanged(); return this; } public Builder clearHost() { - bitField0_ = (bitField0_ & ~0x00000002); + bitField0_ = (bitField0_ & ~0x00000001); host_ = getDefaultInstance().getHost(); onChanged(); return this; } void setHost(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000001; host_ = value; onChanged(); } - // required uint32 port = 3; + // required uint32 port = 2; private int port_ ; public boolean hasPort() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000002) == 0x00000002); } public int getPort() { return port_; } public Builder setPort(int value) { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000002; port_ = value; onChanged(); return this; } public Builder clearPort() { - bitField0_ = (bitField0_ & ~0x00000004); + bitField0_ = (bitField0_ & ~0x00000002); port_ = 0; onChanged(); return this; } + // required string path = 3; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000004); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + } + // @@protoc_insertion_point(builder_scope:ActorRefProtocol) } @@ -5469,9 +5469,9 @@ public final class RemoteProtocol { boolean hasMessageType(); akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType getMessageType(); - // optional string actorAddress = 2; - boolean hasActorAddress(); - String getActorAddress(); + // optional string actorPath = 2; + boolean hasActorPath(); + String getActorPath(); // optional bytes payload = 3; boolean hasPayload(); @@ -5521,14 +5521,14 @@ public final class RemoteProtocol { return messageType_; } - // optional string actorAddress = 2; - public static final int ACTORADDRESS_FIELD_NUMBER = 2; - private java.lang.Object actorAddress_; - public boolean hasActorAddress() { + // optional string actorPath = 2; + public static final int ACTORPATH_FIELD_NUMBER = 2; + private java.lang.Object actorPath_; + public boolean hasActorPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public String getActorAddress() { - java.lang.Object ref = actorAddress_; + public String getActorPath() { + java.lang.Object ref = actorPath_; if (ref instanceof String) { return (String) ref; } else { @@ -5536,17 +5536,17 @@ public final class RemoteProtocol { (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); if (com.google.protobuf.Internal.isValidUtf8(bs)) { - actorAddress_ = s; + actorPath_ = s; } return s; } } - private com.google.protobuf.ByteString getActorAddressBytes() { - java.lang.Object ref = actorAddress_; + private com.google.protobuf.ByteString getActorPathBytes() { + java.lang.Object ref = actorPath_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - actorAddress_ = b; + actorPath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; @@ -5578,7 +5578,7 @@ public final class RemoteProtocol { private void initFields() { messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP; - actorAddress_ = ""; + actorPath_ = ""; payload_ = com.google.protobuf.ByteString.EMPTY; replicateActorFromUuid_ = akka.remote.RemoteProtocol.UuidProtocol.getDefaultInstance(); } @@ -5608,7 +5608,7 @@ public final class RemoteProtocol { output.writeEnum(1, messageType_.getNumber()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getActorAddressBytes()); + output.writeBytes(2, getActorPathBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, payload_); @@ -5631,7 +5631,7 @@ public final class RemoteProtocol { } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getActorAddressBytes()); + .computeBytesSize(2, getActorPathBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream @@ -5768,7 +5768,7 @@ public final class RemoteProtocol { super.clear(); messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP; bitField0_ = (bitField0_ & ~0x00000001); - actorAddress_ = ""; + actorPath_ = ""; bitField0_ = (bitField0_ & ~0x00000002); payload_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); @@ -5823,7 +5823,7 @@ public final class RemoteProtocol { if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } - result.actorAddress_ = actorAddress_; + result.actorPath_ = actorPath_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } @@ -5855,8 +5855,8 @@ public final class RemoteProtocol { if (other.hasMessageType()) { setMessageType(other.getMessageType()); } - if (other.hasActorAddress()) { - setActorAddress(other.getActorAddress()); + if (other.hasActorPath()) { + setActorPath(other.getActorPath()); } if (other.hasPayload()) { setPayload(other.getPayload()); @@ -5918,7 +5918,7 @@ public final class RemoteProtocol { } case 18: { bitField0_ |= 0x00000002; - actorAddress_ = input.readBytes(); + actorPath_ = input.readBytes(); break; } case 26: { @@ -5965,39 +5965,39 @@ public final class RemoteProtocol { return this; } - // optional string actorAddress = 2; - private java.lang.Object actorAddress_ = ""; - public boolean hasActorAddress() { + // optional string actorPath = 2; + private java.lang.Object actorPath_ = ""; + public boolean hasActorPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public String getActorAddress() { - java.lang.Object ref = actorAddress_; + public String getActorPath() { + java.lang.Object ref = actorPath_; if (!(ref instanceof String)) { String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - actorAddress_ = s; + actorPath_ = s; return s; } else { return (String) ref; } } - public Builder setActorAddress(String value) { + public Builder setActorPath(String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; - actorAddress_ = value; + actorPath_ = value; onChanged(); return this; } - public Builder clearActorAddress() { + public Builder clearActorPath() { bitField0_ = (bitField0_ & ~0x00000002); - actorAddress_ = getDefaultInstance().getActorAddress(); + actorPath_ = getDefaultInstance().getActorPath(); onChanged(); return this; } - void setActorAddress(com.google.protobuf.ByteString value) { + void setActorPath(com.google.protobuf.ByteString value) { bitField0_ |= 0x00000002; - actorAddress_ = value; + actorPath_ = value; onChanged(); } @@ -6864,35 +6864,35 @@ public final class RemoteProtocol { "\0132\026.MetadataEntryProtocol\"l\n\025RemoteContr" + "olProtocol\022!\n\013commandType\030\001 \002(\0162\014.Comman", "dType\022\016\n\006cookie\030\002 \001(\t\022 \n\006origin\030\003 \001(\0132\020." + - "AddressProtocol\"?\n\020ActorRefProtocol\022\017\n\007a" + - "ddress\030\001 \002(\t\022\014\n\004host\030\002 \002(\t\022\014\n\004port\030\003 \002(\r" + - "\";\n\017MessageProtocol\022\017\n\007message\030\001 \002(\014\022\027\n\017" + - "messageManifest\030\002 \001(\014\")\n\014UuidProtocol\022\014\n" + - "\004high\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025MetadataEntr" + - "yProtocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\014\"1\n" + - "\017AddressProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004po" + - "rt\030\002 \002(\r\"7\n\021ExceptionProtocol\022\021\n\tclassna" + - "me\030\001 \002(\t\022\017\n\007message\030\002 \002(\t\"\256\001\n!RemoteSyst", - "emDaemonMessageProtocol\0223\n\013messageType\030\001" + - " \002(\0162\036.RemoteSystemDaemonMessageType\022\024\n\014" + - "actorAddress\030\002 \001(\t\022\017\n\007payload\030\003 \001(\014\022-\n\026r" + - "eplicateActorFromUuid\030\004 \001(\0132\r.UuidProtoc" + - "ol\"y\n\035DurableMailboxMessageProtocol\022$\n\tr" + - "ecipient\030\001 \002(\0132\021.ActorRefProtocol\022!\n\006sen" + - "der\030\002 \001(\0132\021.ActorRefProtocol\022\017\n\007message\030" + - "\003 \002(\014*(\n\013CommandType\022\013\n\007CONNECT\020\001\022\014\n\010SHU" + - "TDOWN\020\002*K\n\026ReplicationStorageType\022\r\n\tTRA" + - "NSIENT\020\001\022\023\n\017TRANSACTION_LOG\020\002\022\r\n\tDATA_GR", - "ID\020\003*>\n\027ReplicationStrategyType\022\021\n\rWRITE" + - "_THROUGH\020\001\022\020\n\014WRITE_BEHIND\020\002*\241\002\n\035RemoteS" + - "ystemDaemonMessageType\022\010\n\004STOP\020\001\022\007\n\003USE\020" + - "\002\022\013\n\007RELEASE\020\003\022\022\n\016MAKE_AVAILABLE\020\004\022\024\n\020MA" + - "KE_UNAVAILABLE\020\005\022\016\n\nDISCONNECT\020\006\022\r\n\tRECO" + - "NNECT\020\007\022\n\n\006RESIGN\020\010\022\n\n\006GOSSIP\020\t\022\031\n\025FAIL_" + - "OVER_CONNECTIONS\020\024\022\026\n\022FUNCTION_FUN0_UNIT" + - "\020\025\022\025\n\021FUNCTION_FUN0_ANY\020\026\022\032\n\026FUNCTION_FU" + - "N1_ARG_UNIT\020\027\022\031\n\025FUNCTION_FUN1_ARG_ANY\020\030" + - "B\017\n\013akka.remoteH\001" + "AddressProtocol\"<\n\020ActorRefProtocol\022\014\n\004h" + + "ost\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\022\014\n\004path\030\003 \002(\t\";\n" + + "\017MessageProtocol\022\017\n\007message\030\001 \002(\014\022\027\n\017mes" + + "sageManifest\030\002 \001(\014\")\n\014UuidProtocol\022\014\n\004hi" + + "gh\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025MetadataEntryPr" + + "otocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\014\"1\n\017Ad" + + "dressProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030" + + "\002 \002(\r\"7\n\021ExceptionProtocol\022\021\n\tclassname\030" + + "\001 \002(\t\022\017\n\007message\030\002 \002(\t\"\253\001\n!RemoteSystemD", + "aemonMessageProtocol\0223\n\013messageType\030\001 \002(" + + "\0162\036.RemoteSystemDaemonMessageType\022\021\n\tact" + + "orPath\030\002 \001(\t\022\017\n\007payload\030\003 \001(\014\022-\n\026replica" + + "teActorFromUuid\030\004 \001(\0132\r.UuidProtocol\"y\n\035" + + "DurableMailboxMessageProtocol\022$\n\trecipie" + + "nt\030\001 \002(\0132\021.ActorRefProtocol\022!\n\006sender\030\002 " + + "\001(\0132\021.ActorRefProtocol\022\017\n\007message\030\003 \002(\014*" + + "(\n\013CommandType\022\013\n\007CONNECT\020\001\022\014\n\010SHUTDOWN\020" + + "\002*K\n\026ReplicationStorageType\022\r\n\tTRANSIENT" + + "\020\001\022\023\n\017TRANSACTION_LOG\020\002\022\r\n\tDATA_GRID\020\003*>", + "\n\027ReplicationStrategyType\022\021\n\rWRITE_THROU" + + "GH\020\001\022\020\n\014WRITE_BEHIND\020\002*\241\002\n\035RemoteSystemD" + + "aemonMessageType\022\010\n\004STOP\020\001\022\007\n\003USE\020\002\022\013\n\007R" + + "ELEASE\020\003\022\022\n\016MAKE_AVAILABLE\020\004\022\024\n\020MAKE_UNA" + + "VAILABLE\020\005\022\016\n\nDISCONNECT\020\006\022\r\n\tRECONNECT\020" + + "\007\022\n\n\006RESIGN\020\010\022\n\n\006GOSSIP\020\t\022\031\n\025FAIL_OVER_C" + + "ONNECTIONS\020\024\022\026\n\022FUNCTION_FUN0_UNIT\020\025\022\025\n\021" + + "FUNCTION_FUN0_ANY\020\026\022\032\n\026FUNCTION_FUN1_ARG" + + "_UNIT\020\027\022\031\n\025FUNCTION_FUN1_ARG_ANY\020\030B\017\n\013ak" + + "ka.remoteH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -6928,7 +6928,7 @@ public final class RemoteProtocol { internal_static_ActorRefProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ActorRefProtocol_descriptor, - new java.lang.String[] { "Address", "Host", "Port", }, + new java.lang.String[] { "Host", "Port", "Path", }, akka.remote.RemoteProtocol.ActorRefProtocol.class, akka.remote.RemoteProtocol.ActorRefProtocol.Builder.class); internal_static_MessageProtocol_descriptor = @@ -6976,7 +6976,7 @@ public final class RemoteProtocol { internal_static_RemoteSystemDaemonMessageProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RemoteSystemDaemonMessageProtocol_descriptor, - new java.lang.String[] { "MessageType", "ActorAddress", "Payload", "ReplicateActorFromUuid", }, + new java.lang.String[] { "MessageType", "ActorPath", "Payload", "ReplicateActorFromUuid", }, akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.class, akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.Builder.class); internal_static_DurableMailboxMessageProtocol_descriptor = diff --git a/akka-remote/src/main/protocol/RemoteProtocol.proto b/akka-remote/src/main/protocol/RemoteProtocol.proto index d777009950..6bd62c8c16 100644 --- a/akka-remote/src/main/protocol/RemoteProtocol.proto +++ b/akka-remote/src/main/protocol/RemoteProtocol.proto @@ -66,9 +66,9 @@ enum ReplicationStrategyType { * on the original node. */ message ActorRefProtocol { - required string address = 1; - required string host = 2; - required uint32 port = 3; + required string host = 1; + required uint32 port = 2; + required string path = 3; } /** @@ -116,7 +116,7 @@ message ExceptionProtocol { */ message RemoteSystemDaemonMessageProtocol { required RemoteSystemDaemonMessageType messageType = 1; - optional string actorAddress = 2; + optional string actorPath = 2; optional bytes payload = 3; optional UuidProtocol replicateActorFromUuid = 4; } diff --git a/akka-remote/src/main/scala/akka/remote/Gossiper.scala b/akka-remote/src/main/scala/akka/remote/Gossiper.scala index 715230893d..0226d771a8 100644 --- a/akka-remote/src/main/scala/akka/remote/Gossiper.scala +++ b/akka-remote/src/main/scala/akka/remote/Gossiper.scala @@ -310,7 +310,7 @@ class Gossiper(remote: Remote) { RemoteSystemDaemonMessageProtocol.newBuilder .setMessageType(GOSSIP) - .setActorAddress(remote.remoteDaemon.path.toString) + .setActorPath(remote.remoteDaemon.path.toString) .setPayload(ByteString.copyFrom(gossipAsBytes)) .build() } diff --git a/akka-remote/src/main/scala/akka/remote/NetworkEventStream.scala b/akka-remote/src/main/scala/akka/remote/NetworkEventStream.scala index 872b2c23f3..698f128897 100644 --- a/akka-remote/src/main/scala/akka/remote/NetworkEventStream.scala +++ b/akka-remote/src/main/scala/akka/remote/NetworkEventStream.scala @@ -67,7 +67,7 @@ class NetworkEventStream(val app: AkkaApplication) { // FIXME: check that this supervision is correct private[akka] val sender = app.provider.actorOf( Props[Channel].copy(dispatcher = app.dispatcherFactory.newPinnedDispatcher("NetworkEventStream")), - app.guardian, Props.randomAddress, systemService = true) + app.guardian, Props.randomName, systemService = true) /** * Registers a network event stream listener (asyncronously). diff --git a/akka-remote/src/main/scala/akka/remote/Remote.scala b/akka-remote/src/main/scala/akka/remote/Remote.scala index 5b5026bd30..7d407e6f13 100644 --- a/akka-remote/src/main/scala/akka/remote/Remote.scala +++ b/akka-remote/src/main/scala/akka/remote/Remote.scala @@ -129,7 +129,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { def handleUse(message: RemoteSystemDaemonMessageProtocol) { try { - if (message.hasActorAddress) { + if (message.hasActorPath) { val actorFactoryBytes = if (shouldCompressData) LZF.uncompress(message.getPayload.toByteArray) else message.getPayload.toByteArray @@ -140,7 +140,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { case Right(instance) ⇒ instance.asInstanceOf[() ⇒ Actor] } - val actorPath = ActorPath(remote.app, message.getActorAddress) + val actorPath = ActorPath(remote.app, message.getActorPath) val parent = actorPath.parent.ref if (parent.isDefined) { @@ -188,7 +188,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { Props( context ⇒ { case f: Function0[_] ⇒ try { f() } finally { context.self.stop() } - }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) + }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) } // FIXME: handle real remote supervision @@ -197,7 +197,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { Props( context ⇒ { case f: Function0[_] ⇒ try { sender ! f() } finally { context.self.stop() } - }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) + }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) } // FIXME: handle real remote supervision @@ -206,7 +206,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { Props( context ⇒ { case (fun: Function[_, _], param: Any) ⇒ try { fun.asInstanceOf[Any ⇒ Unit].apply(param) } finally { context.self.stop() } - }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) + }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) } // FIXME: handle real remote supervision @@ -215,7 +215,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor { Props( context ⇒ { case (fun: Function[_, _], param: Any) ⇒ try { sender ! fun.asInstanceOf[Any ⇒ Any](param) } finally { context.self.stop() } - }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) + }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) } def handleFailover(message: RemoteSystemDaemonMessageProtocol) { @@ -235,11 +235,11 @@ class RemoteMessage(input: RemoteMessageProtocol, remote: RemoteSupport, classLo lazy val sender: ActorRef = if (input.hasSender) remote.app.provider.deserialize( - SerializedActorRef(input.getSender.getHost, input.getSender.getPort, input.getSender.getAddress)).getOrElse(throw new IllegalStateException("OHNOES")) + SerializedActorRef(input.getSender.getHost, input.getSender.getPort, input.getSender.getPath)).getOrElse(throw new IllegalStateException("OHNOES")) else remote.app.deadLetters - lazy val recipient: ActorRef = remote.app.actorFor(input.getRecipient.getAddress).getOrElse(remote.app.deadLetters) + lazy val recipient: ActorRef = remote.app.actorFor(input.getRecipient.getPath).getOrElse(remote.app.deadLetters) lazy val payload: Either[Throwable, AnyRef] = if (input.hasException) Left(parseException()) @@ -261,7 +261,7 @@ class RemoteMessage(input: RemoteMessageProtocol, remote: RemoteSupport, classLo } } - override def toString = "RemoteMessage: " + recipient + "(" + input.getRecipient.getAddress + ") from " + sender + override def toString = "RemoteMessage: " + recipient + "(" + input.getRecipient.getPath + ") from " + sender } trait RemoteMarshallingOps { @@ -285,7 +285,7 @@ trait RemoteMarshallingOps { */ def toRemoteActorRefProtocol(actor: ActorRef): ActorRefProtocol = { val rep = app.provider.serialize(actor) - ActorRefProtocol.newBuilder.setHost(rep.hostname).setPort(rep.port).setAddress(rep.path).build + ActorRefProtocol.newBuilder.setHost(rep.hostname).setPort(rep.port).setPath(rep.path).build } def createRemoteMessageProtocolBuilder( diff --git a/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala b/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala index d4a0066883..38d07e8e36 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala @@ -198,7 +198,7 @@ class RemoteActorRefProvider(val app: AkkaApplication) extends ActorRefProvider val command = RemoteSystemDaemonMessageProtocol.newBuilder .setMessageType(USE) - .setActorAddress(actorPath) + .setActorPath(actorPath) .setPayload(ByteString.copyFrom(actorFactoryBytes)) .build() diff --git a/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala b/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala index ca2fb13fc8..a97e5591d2 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala @@ -41,25 +41,25 @@ class TestActorRef[T <: Actor](_app: AkkaApplication, _props: Props, _supervisor object TestActorRef { - def apply[T <: Actor](factory: ⇒ T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomAddress) + def apply[T <: Actor](factory: ⇒ T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomName) - def apply[T <: Actor](factory: ⇒ T, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), address) + def apply[T <: Actor](factory: ⇒ T, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), name) - def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomAddress) + def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomName) - def apply[T <: Actor](props: Props, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, address) + def apply[T <: Actor](props: Props, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, name) - def apply[T <: Actor](props: Props, supervisor: ActorRef, address: String)(implicit app: AkkaApplication): TestActorRef[T] = { - val name: String = address match { - case null | Props.randomAddress ⇒ newUuid.toString - case given ⇒ given + def apply[T <: Actor](props: Props, supervisor: ActorRef, givenName: String)(implicit app: AkkaApplication): TestActorRef[T] = { + val name: String = givenName match { + case null | Props.randomName ⇒ newUuid.toString + case given ⇒ given } new TestActorRef(app, props, supervisor, name) } - def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomAddress) + def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomName) - def apply[T <: Actor](address: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({ + def apply[T <: Actor](name: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({ import ReflectiveAccess.{ createInstance, noParams, noArgs } createInstance[T](m.erasure, noParams, noArgs) match { case Right(value) ⇒ value @@ -69,5 +69,5 @@ object TestActorRef { "\nif so put it outside the class/trait, f.e. in a companion object," + "\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'.", exception) } - }), address) + }), name) } diff --git a/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala b/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala index 6ea2e058c6..772f390a68 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala @@ -34,8 +34,8 @@ import akka.AkkaApplication * @author Roland Kuhn * @since 1.2 */ -class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, supervisor: ActorRef, address: String)(implicit ev: T <:< FSM[S, D]) - extends TestActorRef(app, props, supervisor, address) { +class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, supervisor: ActorRef, name: String)(implicit ev: T <:< FSM[S, D]) + extends TestActorRef(app, props, supervisor, name) { private def fsm: T = underlyingActor @@ -81,8 +81,8 @@ class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, superviso object TestFSMRef { def apply[S, D, T <: Actor](factory: ⇒ T)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = - new TestFSMRef(app, Props(creator = () ⇒ factory), app.guardian, Props.randomAddress) + new TestFSMRef(app, Props(creator = () ⇒ factory), app.guardian, Props.randomName) - def apply[S, D, T <: Actor](factory: ⇒ T, address: String)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = - new TestFSMRef(app, Props(creator = () ⇒ factory), app.guardian, address) + def apply[S, D, T <: Actor](factory: ⇒ T, name: String)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = + new TestFSMRef(app, Props(creator = () ⇒ factory), app.guardian, name) }