diff --git a/akka-actor/src/main/scala/akka/actor/ActorCell.scala b/akka-actor/src/main/scala/akka/actor/ActorCell.scala index 2cd84f85f4..7ca838c5ee 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorCell.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorCell.scala @@ -111,6 +111,7 @@ private[akka] class ActorCell( def start(): Unit = { if (props.supervisor.isDefined) props.supervisor.get.link(self) dispatcher.attach(this) + Actor.registry.register(self) dispatcher.systemDispatch(SystemMessageInvocation(this, Create, NullChannel)) } @@ -232,7 +233,6 @@ private[akka] class ActorCell( val created = newActor(restart = false) actor.set(created) created.preStart() - Actor.registry.register(self) case instance if recreation ⇒ restart(new Exception("Restart commanded"), None, None) case _ ⇒ diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index 1c8ece435f..ba09de903b 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -262,7 +262,14 @@ class LocalActorRef private[akka] ( protected[akka] def underlying: ActorCell = actorCell - protected[akka] def underlyingActorInstance: Actor = actorCell.actor.get + protected[akka] def underlyingActorInstance: Actor = { + var instance = actorCell.actor.get + while (instance eq null) { + try { Thread.sleep(1) } catch { case i: InterruptedException ⇒ } + instance = actorCell.actor.get + } + instance + } protected[akka] override def timeout: Long = props.timeout.duration.toMillis // TODO: remove this if possible diff --git a/akka-camel/src/main/scala/akka/camel/component/ActorComponent.scala b/akka-camel/src/main/scala/akka/camel/component/ActorComponent.scala index b2f7100ed6..aa487ff588 100644 --- a/akka-camel/src/main/scala/akka/camel/component/ActorComponent.scala +++ b/akka-camel/src/main/scala/akka/camel/component/ActorComponent.scala @@ -224,7 +224,7 @@ private[camel] object ActorProducer { * @author Martin Krasser */ class ActorNotRegisteredException(uri: String) extends RuntimeException { - override def getMessage = "%s not registered" format uri + override def getMessage = "'%s' not registered" format uri } /**