Removing 'name' from dispatchers, just use id, much better

This commit is contained in:
Viktor Klang 2012-01-19 19:08:51 +01:00
parent 2e40cdcf0e
commit d888ca5bff
8 changed files with 4 additions and 26 deletions

View file

@ -450,7 +450,6 @@ object DispatcherModelSpec {
private val instance: MessageDispatcher = { private val instance: MessageDispatcher = {
configureThreadPool(config, configureThreadPool(config,
threadPoolConfig new Dispatcher(prerequisites, threadPoolConfig new Dispatcher(prerequisites,
config.getString("name"),
config.getString("id"), config.getString("id"),
config.getInt("throughput"), config.getInt("throughput"),
Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS), Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS),
@ -525,7 +524,6 @@ object BalancingDispatcherModelSpec {
private val instance: MessageDispatcher = { private val instance: MessageDispatcher = {
configureThreadPool(config, configureThreadPool(config,
threadPoolConfig new BalancingDispatcher(prerequisites, threadPoolConfig new BalancingDispatcher(prerequisites,
config.getString("name"),
config.getString("id"), config.getString("id"),
config.getInt("throughput"), config.getInt("throughput"),
Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS), Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS),

View file

@ -58,11 +58,6 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) {
dispatcher.throughput must be(17) dispatcher.throughput must be(17)
} }
"use specific name" in {
val dispatcher = lookup("myapp.mydispatcher")
dispatcher.name must be("mydispatcher")
}
"use specific id" in { "use specific id" in {
val dispatcher = lookup("myapp.mydispatcher") val dispatcher = lookup("myapp.mydispatcher")
dispatcher.id must be("myapp.mydispatcher") dispatcher.id must be("myapp.mydispatcher")
@ -95,7 +90,6 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) {
val d1 = lookup("myapp.mydispatcher") val d1 = lookup("myapp.mydispatcher")
val d2 = lookup("myapp.mydispatcher") val d2 = lookup("myapp.mydispatcher")
d1 must be === d2 d1 must be === d2
d1.name must be("mydispatcher")
} }
} }

View file

@ -155,9 +155,6 @@ akka {
# parameters # parameters
type = "Dispatcher" type = "Dispatcher"
# Name used in log messages and thread names.
name = "default-dispatcher"
# Toggles whether the threads created by this dispatcher should be daemons or not # Toggles whether the threads created by this dispatcher should be daemons or not
daemonic = off daemonic = off

View file

@ -139,11 +139,6 @@ abstract class MessageDispatcher(val prerequisites: DispatcherPrerequisites) ext
*/ */
protected[akka] def createMailbox(actor: ActorCell): Mailbox protected[akka] def createMailbox(actor: ActorCell): Mailbox
/**
* Name of this dispatcher.
*/
def name: String
/** /**
* Identifier of this dispatcher, corresponds to the full key * Identifier of this dispatcher, corresponds to the full key
* of the dispatcher configuration. * of the dispatcher configuration.

View file

@ -31,14 +31,13 @@ import akka.util.Duration
*/ */
class BalancingDispatcher( class BalancingDispatcher(
_prerequisites: DispatcherPrerequisites, _prerequisites: DispatcherPrerequisites,
_name: String,
_id: String, _id: String,
throughput: Int, throughput: Int,
throughputDeadlineTime: Duration, throughputDeadlineTime: Duration,
mailboxType: MailboxType, mailboxType: MailboxType,
config: ThreadPoolConfig, config: ThreadPoolConfig,
_shutdownTimeout: Duration) _shutdownTimeout: Duration)
extends Dispatcher(_prerequisites, _name, _id, throughput, throughputDeadlineTime, mailboxType, config, _shutdownTimeout) { extends Dispatcher(_prerequisites, _id, throughput, throughputDeadlineTime, mailboxType, config, _shutdownTimeout) {
val buddies = new ConcurrentSkipListSet[ActorCell](akka.util.Helpers.IdentityHashComparator) val buddies = new ConcurrentSkipListSet[ActorCell](akka.util.Helpers.IdentityHashComparator)
val rebalance = new AtomicBoolean(false) val rebalance = new AtomicBoolean(false)

View file

@ -24,7 +24,6 @@ import java.util.concurrent._
*/ */
class Dispatcher( class Dispatcher(
_prerequisites: DispatcherPrerequisites, _prerequisites: DispatcherPrerequisites,
val name: String,
val id: String, val id: String,
val throughput: Int, val throughput: Int,
val throughputDeadlineTime: Duration, val throughputDeadlineTime: Duration,
@ -33,7 +32,7 @@ class Dispatcher(
val shutdownTimeout: Duration) val shutdownTimeout: Duration)
extends MessageDispatcher(_prerequisites) { extends MessageDispatcher(_prerequisites) {
protected[akka] val executorServiceFactory = executorServiceFactoryProvider.createExecutorServiceFactory(name) protected[akka] val executorServiceFactory = executorServiceFactoryProvider.createExecutorServiceFactory(id)
protected[akka] val executorService = new AtomicReference[ExecutorService](new ExecutorServiceDelegate { protected[akka] val executorService = new AtomicReference[ExecutorService](new ExecutorServiceDelegate {
lazy val executor = executorServiceFactory.createExecutorService lazy val executor = executorServiceFactory.createExecutorService
}) })
@ -94,7 +93,7 @@ class Dispatcher(
} else false } else false
} }
override val toString = getClass.getSimpleName + "[" + name + "]" override val toString = getClass.getSimpleName + "[" + id + "]"
} }
object PriorityGenerator { object PriorityGenerator {

View file

@ -161,7 +161,6 @@ class DispatcherConfigurator(config: Config, prerequisites: DispatcherPrerequisi
private val instance = private val instance =
configureThreadPool(config, configureThreadPool(config,
threadPoolConfig new Dispatcher(prerequisites, threadPoolConfig new Dispatcher(prerequisites,
config.getString("name"),
config.getString("id"), config.getString("id"),
config.getInt("throughput"), config.getInt("throughput"),
Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS), Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS),
@ -186,7 +185,6 @@ class BalancingDispatcherConfigurator(config: Config, prerequisites: DispatcherP
private val instance = private val instance =
configureThreadPool(config, configureThreadPool(config,
threadPoolConfig new BalancingDispatcher(prerequisites, threadPoolConfig new BalancingDispatcher(prerequisites,
config.getString("name"),
config.getString("id"), config.getString("id"),
config.getInt("throughput"), config.getInt("throughput"),
Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS), Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS),
@ -211,7 +209,7 @@ class PinnedDispatcherConfigurator(config: Config, prerequisites: DispatcherPrer
*/ */
override def dispatcher(): MessageDispatcher = configureThreadPool(config, override def dispatcher(): MessageDispatcher = configureThreadPool(config,
threadPoolConfig threadPoolConfig
new PinnedDispatcher(prerequisites, null, config.getString("name"), config.getString("id"), mailboxType, new PinnedDispatcher(prerequisites, null, config.getString("id"), mailboxType,
Duration(config.getMilliseconds("shutdown-timeout"), TimeUnit.MILLISECONDS), Duration(config.getMilliseconds("shutdown-timeout"), TimeUnit.MILLISECONDS),
threadPoolConfig)).build threadPoolConfig)).build

View file

@ -21,13 +21,11 @@ import java.util.concurrent.TimeUnit
class PinnedDispatcher( class PinnedDispatcher(
_prerequisites: DispatcherPrerequisites, _prerequisites: DispatcherPrerequisites,
_actor: ActorCell, _actor: ActorCell,
_name: String,
_id: String, _id: String,
_mailboxType: MailboxType, _mailboxType: MailboxType,
_shutdownTimeout: Duration, _shutdownTimeout: Duration,
_threadPoolConfig: ThreadPoolConfig = ThreadPoolConfig()) _threadPoolConfig: ThreadPoolConfig = ThreadPoolConfig())
extends Dispatcher(_prerequisites, extends Dispatcher(_prerequisites,
_name,
_id, _id,
Int.MaxValue, Int.MaxValue,
Duration.Zero, Duration.Zero,