Removed some unessary dispatcher constants in ActorSystem.Settings. See #1458

This commit is contained in:
Patrik Nordwall 2011-12-21 20:57:57 +01:00
parent 817c3c5ee7
commit fdf93fe2cc
4 changed files with 12 additions and 19 deletions

View file

@ -19,6 +19,7 @@ import akka.util.duration._
import akka.event.Logging.Error
import com.typesafe.config.Config
import java.util.concurrent.atomic.AtomicInteger
import akka.util.Duration
object ActorModelSpec {
@ -230,6 +231,11 @@ abstract class ActorModelSpec(config: String) extends AkkaSpec(config) with Defa
import ActorModelSpec._
// FIXME Remove these settings as part of ticket #1563
val DispatcherThroughput = system.settings.config.getInt("akka.actor.default-dispatcher.throughput")
val DispatcherDefaultShutdown = Duration(system.settings.config.getMilliseconds("akka.actor.default-dispatcher.shutdown-timeout"), TimeUnit.MILLISECONDS)
val DispatcherThroughputDeadlineTime = Duration(system.settings.config.getNanoseconds("akka.actor.default-dispatcher.throughput-deadline-time"), TimeUnit.NANOSECONDS)
def newTestActor(dispatcher: String) = system.actorOf(Props[DispatcherActor].withDispatcher(dispatcher))
protected def registerInterceptedDispatcher(): MessageDispatcherInterceptor
@ -447,9 +453,9 @@ class DispatcherModelSpec extends ActorModelSpec(DispatcherModelSpec.config) {
val dispatcherConfigurator = new MessageDispatcherConfigurator(system.settings.config.getConfig("dispatcher"), system.dispatchers.prerequisites) {
val instance = {
ThreadPoolConfigDispatcherBuilder(config
new Dispatcher(system.dispatchers.prerequisites, id, id, system.settings.DispatcherThroughput,
system.settings.DispatcherThroughputDeadlineTime, system.dispatchers.MailboxType,
config, system.settings.DispatcherDefaultShutdown) with MessageDispatcherInterceptor,
new Dispatcher(system.dispatchers.prerequisites, id, id, DispatcherThroughput,
DispatcherThroughputDeadlineTime, UnboundedMailbox(), config,
DispatcherDefaultShutdown) with MessageDispatcherInterceptor,
ThreadPoolConfig()).build
}
override def dispatcher(): MessageDispatcher = instance
@ -509,8 +515,8 @@ class BalancingDispatcherModelSpec extends ActorModelSpec(BalancingDispatcherMod
val instance = {
ThreadPoolConfigDispatcherBuilder(config
new BalancingDispatcher(system.dispatchers.prerequisites, id, id, 1, // TODO check why 1 here? (came from old test)
system.settings.DispatcherThroughputDeadlineTime, system.dispatchers.MailboxType,
config, system.settings.DispatcherDefaultShutdown) with MessageDispatcherInterceptor,
DispatcherThroughputDeadlineTime, UnboundedMailbox(),
config, DispatcherDefaultShutdown) with MessageDispatcherInterceptor,
ThreadPoolConfig()).build
}

View file

@ -35,11 +35,8 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference) {
getMilliseconds("akka.actor.default-dispatcher.mailbox-push-timeout-time") must equal(10 * 1000)
getString("akka.actor.default-dispatcher.mailboxType") must be("")
getMilliseconds("akka.actor.default-dispatcher.shutdown-timeout") must equal(1 * 1000)
settings.DispatcherDefaultShutdown must equal(1 second)
getInt("akka.actor.default-dispatcher.throughput") must equal(5)
settings.DispatcherThroughput must equal(5)
getMilliseconds("akka.actor.default-dispatcher.throughput-deadline-time") must equal(0)
settings.DispatcherThroughputDeadlineTime must equal(Duration.Zero)
getBoolean("akka.actor.serialize-messages") must equal(false)
settings.SerializeAllMessages must equal(false)

View file

@ -88,12 +88,6 @@ object ActorSystem {
val FsmDebugEvent = getBoolean("akka.actor.debug.fsm")
val DebugEventStream = getBoolean("akka.actor.debug.event-stream")
val DispatcherThroughput = getInt("akka.actor.default-dispatcher.throughput")
val DispatcherDefaultShutdown = Duration(getMilliseconds("akka.actor.default-dispatcher.shutdown-timeout"), MILLISECONDS)
val MailboxCapacity = getInt("akka.actor.default-dispatcher.mailbox-capacity")
val MailboxPushTimeout = Duration(getNanoseconds("akka.actor.default-dispatcher.mailbox-push-timeout-time"), NANOSECONDS)
val DispatcherThroughputDeadlineTime = Duration(getNanoseconds("akka.actor.default-dispatcher.throughput-deadline-time"), NANOSECONDS)
val Home = config.getString("akka.home") match {
case "" None
case x Some(x)

View file

@ -112,7 +112,7 @@ class Dispatchers(val settings: ActorSystem.Settings, val prerequisites: Dispatc
}
}
// FIXME #1458: Not sure if we should have this, but needed it temporary for ActorModelSpec and DispatcherDocSpec
// FIXME #1563: Remove this method when dispatcher usage is rewritten in ActorModelSpec and CallingThreadDispatcherModelSpec
private[akka] def register(id: String, dispatcherConfigurator: MessageDispatcherConfigurator): Unit = {
dispatcherConfigurators.putIfAbsent(id, dispatcherConfigurator)
}
@ -131,10 +131,6 @@ class Dispatchers(val settings: ActorSystem.Settings, val prerequisites: Dispatc
ConfigFactory.parseMap(Map("id" -> id).asJava)
}
val MailboxType: MailboxType =
if (settings.MailboxCapacity < 1) UnboundedMailbox()
else BoundedMailbox(settings.MailboxCapacity, settings.MailboxPushTimeout)
/*
* Creates of obtains a dispatcher from a Config according to the format below.
*