From c5ed2a8f21961f2eeca3adf2161038035b67f2cb Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Thu, 13 Oct 2011 16:36:47 +0200 Subject: [PATCH] Making so that if the given address to a LocalActorRef is null or the empty string, it should use the toString of the uuid --- akka-actor/src/main/scala/akka/actor/ActorRef.scala | 7 ++++++- akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index 2884a8e4b3..8399e89504 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -164,7 +164,7 @@ abstract class ActorRef extends ActorRefShared with UntypedChannel with ReplyCha */ class LocalActorRef private[akka] ( private[this] val props: Props, - val address: String, + givenAddress: String, val systemService: Boolean = false, override private[akka] val uuid: Uuid = newUuid, receiveTimeout: Option[Long] = None, @@ -184,6 +184,11 @@ class LocalActorRef private[akka] ( actorCell.setActorContext(actorCell) // this is needed for deserialization - why? } + final def address: String = givenAddress match { + case null | "" ⇒ uuid.toString + case other ⇒ other + } + private[this] val actorCell = new ActorCell(this, props, receiveTimeout, hotswap) actorCell.start() diff --git a/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala b/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala index 437a3c288a..1e5fa15f30 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala @@ -46,7 +46,7 @@ object Remote extends RemoteService { private[remote] lazy val remoteDaemon = new LocalActorRef( props = Props(new RemoteDaemon).withDispatcher(new PinnedDispatcher()).withSupervisor(remoteDaemonSupervisor), - address = Remote.remoteDaemonServiceName, + givenAddress = Remote.remoteDaemonServiceName, systemService = true) private[remote] lazy val remoteClientLifeCycleHandler = actorOf(Props(new Actor {