Adjustments based on review. See #1805

This commit is contained in:
Patrik Nordwall 2012-02-08 14:03:31 +01:00
parent 1f988889c2
commit df1606a8ee
4 changed files with 12 additions and 8 deletions

View file

@ -107,7 +107,7 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend
"include system name and dispatcher id in thread names for fork-join-executor" in {
system.actorOf(Props[ThreadNameEcho].withDispatcher("myapp.mydispatcher")) ! "what's the name?"
val Expected = "(DispatchersSpec-myapp.mydispatcher-[1-9][0-9]*-worker-[1-9][0-9]*)".r
val Expected = "(DispatchersSpec-myapp.mydispatcher-[1-9][0-9]*)".r
expectMsgPF(5 seconds) {
case Expected(x)
}
@ -123,7 +123,7 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend
"include system name and dispatcher id in thread names for default-dispatcher" in {
system.actorOf(Props[ThreadNameEcho]) ! "what's the name?"
val Expected = "(DispatchersSpec-akka.actor.default-dispatcher-[1-9][0-9]*-worker-[1-9][0-9]*)".r
val Expected = "(DispatchersSpec-akka.actor.default-dispatcher-[1-9][0-9]*)".r
expectMsgPF(5 seconds) {
case Expected(x)
}

View file

@ -422,8 +422,10 @@ class ThreadPoolExecutorConfigurator(config: Config, prerequisites: DispatcherPr
def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
val tf = threadFactory match {
case m: MonitorableThreadFactory m.copy(m.name + "-" + id)
case other other
case m: MonitorableThreadFactory
// add the dispatcher id to the thread names
m.copy(m.name + "-" + id)
case other other
}
threadPoolConfig.createExecutorServiceFactory(id, tf)
}
@ -476,8 +478,10 @@ class ForkJoinExecutorConfigurator(config: Config, prerequisites: DispatcherPrer
}
final def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
val tf = threadFactory match {
case m: MonitorableThreadFactory m.copy(m.name + "-" + id)
case other other
case m: MonitorableThreadFactory
// add the dispatcher id to the thread names
m.copy(m.name + "-" + id)
case other other
}
new ForkJoinExecutorServiceFactory(
validate(tf),

View file

@ -173,7 +173,7 @@ case class MonitorableThreadFactory(name: String,
def newThread(pool: ForkJoinPool): ForkJoinWorkerThread = {
val t = wire(ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool))
// Name of the threads for the ForkJoinPool are not customizable. Change it here.
if (t.getName.startsWith("ForkJoinPool-")) t.setName(name + "-" + t.getName.substring("ForkJoinPool-".length))
t.setName(name + "-" + counter.incrementAndGet())
t
}

View file

@ -59,7 +59,7 @@ class Slf4jEventHandlerSpec extends AkkaSpec(Slf4jEventHandlerSpec.config) with
output.reset()
}
val sourceThreadRegex = "sourceThread=\\[Slf4jEventHandlerSpec-akka.actor.default-dispatcher-[1-9][0-9]*-worker-[1-9][0-9]*\\]"
val sourceThreadRegex = "sourceThread=\\[Slf4jEventHandlerSpec-akka.actor.default-dispatcher-[1-9][0-9]*\\]"
"Slf4jEventHandler" must {