Adjustments based on review. See #1805
This commit is contained in:
parent
1f988889c2
commit
df1606a8ee
4 changed files with 12 additions and 8 deletions
|
|
@ -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 {
|
"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?"
|
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) {
|
expectMsgPF(5 seconds) {
|
||||||
case Expected(x) ⇒
|
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 {
|
"include system name and dispatcher id in thread names for default-dispatcher" in {
|
||||||
system.actorOf(Props[ThreadNameEcho]) ! "what's the name?"
|
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) {
|
expectMsgPF(5 seconds) {
|
||||||
case Expected(x) ⇒
|
case Expected(x) ⇒
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -422,8 +422,10 @@ class ThreadPoolExecutorConfigurator(config: Config, prerequisites: DispatcherPr
|
||||||
|
|
||||||
def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
|
def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
|
||||||
val tf = threadFactory match {
|
val tf = threadFactory match {
|
||||||
case m: MonitorableThreadFactory ⇒ m.copy(m.name + "-" + id)
|
case m: MonitorableThreadFactory ⇒
|
||||||
case other ⇒ other
|
// add the dispatcher id to the thread names
|
||||||
|
m.copy(m.name + "-" + id)
|
||||||
|
case other ⇒ other
|
||||||
}
|
}
|
||||||
threadPoolConfig.createExecutorServiceFactory(id, tf)
|
threadPoolConfig.createExecutorServiceFactory(id, tf)
|
||||||
}
|
}
|
||||||
|
|
@ -476,8 +478,10 @@ class ForkJoinExecutorConfigurator(config: Config, prerequisites: DispatcherPrer
|
||||||
}
|
}
|
||||||
final def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
|
final def createExecutorServiceFactory(id: String, threadFactory: ThreadFactory): ExecutorServiceFactory = {
|
||||||
val tf = threadFactory match {
|
val tf = threadFactory match {
|
||||||
case m: MonitorableThreadFactory ⇒ m.copy(m.name + "-" + id)
|
case m: MonitorableThreadFactory ⇒
|
||||||
case other ⇒ other
|
// add the dispatcher id to the thread names
|
||||||
|
m.copy(m.name + "-" + id)
|
||||||
|
case other ⇒ other
|
||||||
}
|
}
|
||||||
new ForkJoinExecutorServiceFactory(
|
new ForkJoinExecutorServiceFactory(
|
||||||
validate(tf),
|
validate(tf),
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ case class MonitorableThreadFactory(name: String,
|
||||||
def newThread(pool: ForkJoinPool): ForkJoinWorkerThread = {
|
def newThread(pool: ForkJoinPool): ForkJoinWorkerThread = {
|
||||||
val t = wire(ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool))
|
val t = wire(ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool))
|
||||||
// Name of the threads for the ForkJoinPool are not customizable. Change it here.
|
// 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
|
t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class Slf4jEventHandlerSpec extends AkkaSpec(Slf4jEventHandlerSpec.config) with
|
||||||
output.reset()
|
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 {
|
"Slf4jEventHandler" must {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue