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 = {
configureThreadPool(config,
threadPoolConfig new Dispatcher(prerequisites,
config.getString("name"),
config.getString("id"),
config.getInt("throughput"),
Duration(config.getNanoseconds("throughput-deadline-time"), TimeUnit.NANOSECONDS),
@ -525,7 +524,6 @@ object BalancingDispatcherModelSpec {
private val instance: MessageDispatcher = {
configureThreadPool(config,
threadPoolConfig new BalancingDispatcher(prerequisites,
config.getString("name"),
config.getString("id"),
config.getInt("throughput"),
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)
}
"use specific name" in {
val dispatcher = lookup("myapp.mydispatcher")
dispatcher.name must be("mydispatcher")
}
"use specific id" in {
val dispatcher = lookup("myapp.mydispatcher")
dispatcher.id must be("myapp.mydispatcher")
@ -95,7 +90,6 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) {
val d1 = lookup("myapp.mydispatcher")
val d2 = lookup("myapp.mydispatcher")
d1 must be === d2
d1.name must be("mydispatcher")
}
}

View file

@ -155,9 +155,6 @@ akka {
# parameters
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
daemonic = off

View file

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

View file

@ -31,14 +31,13 @@ import akka.util.Duration
*/
class BalancingDispatcher(
_prerequisites: DispatcherPrerequisites,
_name: String,
_id: String,
throughput: Int,
throughputDeadlineTime: Duration,
mailboxType: MailboxType,
config: ThreadPoolConfig,
_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 rebalance = new AtomicBoolean(false)

View file

@ -24,7 +24,6 @@ import java.util.concurrent._
*/
class Dispatcher(
_prerequisites: DispatcherPrerequisites,
val name: String,
val id: String,
val throughput: Int,
val throughputDeadlineTime: Duration,
@ -33,7 +32,7 @@ class Dispatcher(
val shutdownTimeout: Duration)
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 {
lazy val executor = executorServiceFactory.createExecutorService
})
@ -94,7 +93,7 @@ class Dispatcher(
} else false
}
override val toString = getClass.getSimpleName + "[" + name + "]"
override val toString = getClass.getSimpleName + "[" + id + "]"
}
object PriorityGenerator {

View file

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

View file

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