Props.defaultDispatcherId -> Dipsatchers.DefaultDispatcherId. See #1458

This commit is contained in:
Patrik Nordwall 2011-12-21 23:46:55 +01:00
parent 0ff920195c
commit ed2fb14dcf
3 changed files with 10 additions and 12 deletions

View file

@ -14,7 +14,7 @@ object BenchmarkConfig {
maxClients = 4
repeatFactor = 2
timeDilation = 1
maxRunDuration = 10 seconds
maxRunDuration = 20 seconds
clientDelay = 250000 nanoseconds
logResult = true
resultDir = "target/benchmark"

View file

@ -21,7 +21,6 @@ object Props {
import FaultHandlingStrategy._
final val defaultCreator: () Actor = () throw new UnsupportedOperationException("No actor creator specified!")
final val defaultDispatcherId: String = null
final val defaultTimeout: Timeout = Timeout(Duration.MinusInf)
final val defaultDecider: Decider = {
case _: ActorInitializationException Stop
@ -125,7 +124,7 @@ object Props {
*/
case class Props(
creator: () Actor = Props.defaultCreator,
dispatcher: String = Props.defaultDispatcherId,
dispatcher: String = Dispatchers.DefaultDispatcherId,
timeout: Timeout = Props.defaultTimeout,
faultHandler: FaultHandlingStrategy = Props.defaultFaultHandler,
routerConfig: RouterConfig = Props.defaultRoutedProps) {
@ -135,7 +134,7 @@ case class Props(
*/
def this() = this(
creator = Props.defaultCreator,
dispatcher = Props.defaultDispatcherId,
dispatcher = Dispatchers.DefaultDispatcherId,
timeout = Props.defaultTimeout,
faultHandler = Props.defaultFaultHandler)
@ -144,7 +143,7 @@ case class Props(
*/
def this(factory: UntypedActorFactory) = this(
creator = () factory.create(),
dispatcher = Props.defaultDispatcherId,
dispatcher = Dispatchers.DefaultDispatcherId,
timeout = Props.defaultTimeout,
faultHandler = Props.defaultFaultHandler)
@ -153,7 +152,7 @@ case class Props(
*/
def this(actorClass: Class[_ <: Actor]) = this(
creator = () actorClass.newInstance,
dispatcher = Props.defaultDispatcherId,
dispatcher = Dispatchers.DefaultDispatcherId,
timeout = Props.defaultTimeout,
faultHandler = Props.defaultFaultHandler,
routerConfig = Props.defaultRoutedProps)

View file

@ -69,24 +69,23 @@ class Dispatchers(val settings: ActorSystem.Settings, val prerequisites: Dispatc
def lookup(id: String): MessageDispatcher = lookupConfigurator(id).dispatcher()
private def lookupConfigurator(id: String): MessageDispatcherConfigurator = {
val lookupId = if (id == Props.defaultDispatcherId) DefaultDispatcherId else id
dispatcherConfigurators.get(lookupId) match {
dispatcherConfigurators.get(id) match {
case null
// It doesn't matter if we create a dispatcher configurator that isn't used due to concurrent lookup.
// That shouldn't happen often and in case it does the actual ExecutorService isn't
// created until used, i.e. cheap.
val newConfigurator =
if (settings.config.hasPath(lookupId)) {
configuratorFrom(config(lookupId))
if (settings.config.hasPath(id)) {
configuratorFrom(config(id))
} else {
// Note that the configurator of the default dispatcher will be registered for this id,
// so this will only be logged once, which is crucial.
prerequisites.eventStream.publish(Warning("Dispatchers",
"Dispatcher [%s] not configured, using default-dispatcher".format(lookupId)))
"Dispatcher [%s] not configured, using default-dispatcher".format(id)))
lookupConfigurator(DefaultDispatcherId)
}
dispatcherConfigurators.putIfAbsent(lookupId, newConfigurator) match {
dispatcherConfigurators.putIfAbsent(id, newConfigurator) match {
case null newConfigurator
case existing existing
}