=act #19201 improve configuration of thread-pool-executor

* The old implementation would cap the pool size (both corePoolSize
  and maximumPoolSize) to max-pool-size, which is very confusing
  becuase maximumPoolSize is only used when the task queue is bounded.
* That resulted in configuring core-pool-size-min and core-pool-size-max
  was not enough, because it could be capped by the default max-pool-size.
* The new behavior is simply that maximumPoolSize is adjusted to not be
  less than corePoolSize, but otherwise the config properties match the
  underlying ThreadPoolExecutor implementation.
* Added a convenience fixed-pool-size property.
This commit is contained in:
Patrik Nordwall 2015-12-17 09:40:03 +01:00
parent a99fee96df
commit a1c3dbe307
19 changed files with 119 additions and 66 deletions

View file

@ -93,6 +93,17 @@ object DispatcherDocSpec {
}
//#my-thread-pool-dispatcher-config
//#fixed-pool-size-dispatcher-config
blocking-io-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 32
}
throughput = 1
}
//#fixed-pool-size-dispatcher-config
//#my-pinned-dispatcher-config
my-pinned-dispatcher {
executor = "thread-pool-executor"
@ -268,11 +279,19 @@ class DispatcherDocSpec extends AkkaSpec(DispatcherDocSpec.config) {
val dispatcher = system.dispatchers.lookup("my-dispatcher-bounded-queue")
}
"defining fixed-pool-size dispatcher" in {
val context = system
//#defining-fixed-pool-size-dispatcher
val myActor =
context.actorOf(Props[MyActor].withDispatcher("blocking-io-dispatcher"), "myactor2")
//#defining-fixed-pool-size-dispatcher
}
"defining pinned dispatcher" in {
val context = system
//#defining-pinned-dispatcher
val myActor =
context.actorOf(Props[MyActor].withDispatcher("my-pinned-dispatcher"), "myactor2")
context.actorOf(Props[MyActor].withDispatcher("my-pinned-dispatcher"), "myactor3")
//#defining-pinned-dispatcher
}