Implementing spinlocking for underlyingActorInstance
This commit is contained in:
parent
fbf9700170
commit
d6eb76852a
3 changed files with 10 additions and 3 deletions
|
|
@ -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 _ ⇒
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue