Initial commit of dispatcher key refactoring, for review. See #1458

* Changed signatures and constructor of MessageDispatcherConfigurator
* Changed Dispatchers.lookup, keep configurators instead of dispatchers
* Removed most of the Dispatchers.newX methods, newDispatcher is still there because of priority mailbox
* How should we make it easy to configure priority mailbox?
* Changed tons tests
* Documentation and ScalaDoc is not updated yet
* Some tests in ActorModelSpec are temporary ignored due to failure
This commit is contained in:
Patrik Nordwall 2011-12-20 21:08:27 +01:00
parent 92bb4c5afb
commit f772b0183e
53 changed files with 627 additions and 496 deletions

View file

@ -21,6 +21,7 @@ import akka.actor.ExtensionId
import akka.actor.ExtensionIdProvider
import akka.actor.ActorSystemImpl
import akka.actor.Extension
import com.typesafe.config.Config
/*
* Locking rules:
@ -92,6 +93,10 @@ private[testkit] class CallingThreadDispatcherQueues extends Extension {
}
}
object CallingThreadDispatcher {
val ConfigKey = "akka.test.calling-thread-dispatcher"
}
/**
* Dispatcher which runs invocations on the current thread only. This
* dispatcher does not create any new threads, but it can be used from
@ -124,6 +129,8 @@ class CallingThreadDispatcher(
val log = akka.event.Logging(prerequisites.eventStream, "CallingThreadDispatcher")
def key: String = ConfigKey
protected[akka] override def createMailbox(actor: ActorCell) = new CallingThreadMailbox(actor)
private def getMailbox(actor: ActorCell): Option[CallingThreadMailbox] = actor.mailbox match {
@ -258,6 +265,13 @@ class CallingThreadDispatcher(
}
}
class CallingThreadDispatcherConfigurator(config: Config, prerequisites: DispatcherPrerequisites)
extends MessageDispatcherConfigurator(config, prerequisites) {
private val instance = new CallingThreadDispatcher(prerequisites)
override def dispatcher(): MessageDispatcher = instance
}
class NestingQueue {
private var q = new LinkedList[Envelope]()
def size = q.size