Merge with master

This commit is contained in:
Viktor Klang 2012-06-25 12:55:25 +02:00
commit 7f429ed63e
54 changed files with 1293 additions and 489 deletions

View file

@ -130,7 +130,7 @@ class CallingThreadDispatcher(
override def id: String = Id
protected[akka] override def createMailbox(actor: ActorCell) = new CallingThreadMailbox(actor, mailboxType)
protected[akka] override def createMailbox(actor: akka.actor.Cell) = new CallingThreadMailbox(actor, mailboxType)
protected[akka] override def shutdown() {}
@ -283,17 +283,21 @@ class NestingQueue(val q: MessageQueue) {
def isActive = active
}
class CallingThreadMailbox(_receiver: ActorCell, val mailboxType: MailboxType) extends Mailbox(_receiver, null) with DefaultSystemMessageQueue {
class CallingThreadMailbox(_receiver: akka.actor.Cell, val mailboxType: MailboxType)
extends Mailbox(null) with DefaultSystemMessageQueue {
val system = _receiver.system
val self = _receiver.self
private val q = new ThreadLocal[NestingQueue]() {
override def initialValue = {
val queue = new NestingQueue(mailboxType.create(Some(actor)))
CallingThreadDispatcherQueues(actor.system).registerQueue(CallingThreadMailbox.this, queue)
val queue = new NestingQueue(mailboxType.create(Some(self), Some(system)))
CallingThreadDispatcherQueues(system).registerQueue(CallingThreadMailbox.this, queue)
queue
}
}
override def enqueue(receiver: ActorRef, msg: Envelope): Unit = throw new UnsupportedOperationException("CallingThreadMailbox cannot enqueue normally")
override def enqueue(receiver: ActorRef, msg: Envelope): Unit = q.get.q.enqueue(receiver, msg)
override def dequeue(): Envelope = throw new UnsupportedOperationException("CallingThreadMailbox cannot dequeue normally")
override def hasMessages: Boolean = q.get.q.hasMessages
override def numberOfMessages: Int = 0
@ -313,7 +317,7 @@ class CallingThreadMailbox(_receiver: ActorCell, val mailboxType: MailboxType) e
val q = queue
CallingThreadDispatcherQueues(actor.system).gatherFromAllOtherQueues(this, q)
super.cleanUp()
q.q.cleanUp(actor, actor.systemImpl.deadLetterQueue)
q.q.cleanUp(actor.self, actor.systemImpl.deadLetterQueue)
}
}
}