Implementing spinlocking for underlyingActorInstance

This commit is contained in:
Viktor Klang 2011-09-21 14:42:26 +02:00
parent fbf9700170
commit d6eb76852a
3 changed files with 10 additions and 3 deletions

View file

@ -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 _

View file

@ -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

View file

@ -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
}
/**