首先,始终使用您正在使用的版本的文档,在您的情况下,您将链接到未发布的 Akka 版本(即快照)的快照文档。
这是 2.1.2 文档:http : //doc.akka.io/docs/akka/2.1.2/scala/dispatchers.html(也可从 doc.akka.io 访问)
当我们查看该页面时,我们看到在 fork-join-executor 和 thread-pool-executor 的示例配置下它说:“有关更多选项,请参阅配置的 default-dispatcher 部分。”,链接到:
我们可以在哪里找到:
# This will be used if you have set "executor = "thread-pool-executor""
thread-pool-executor {
# Keep alive time for threads
keep-alive-time = 60s
# Min number of threads to cap factor-based core number to
core-pool-size-min = 8
# The core pool size factor is used to determine thread pool core size
# using the following formula: ceil(available processors * factor).
# Resulting size is then bounded by the core-pool-size-min and
# core-pool-size-max values.
core-pool-size-factor = 3.0
# Max number of threads to cap factor-based number to
core-pool-size-max = 64
# Minimum number of threads to cap factor-based max number to
# (if using a bounded task queue)
max-pool-size-min = 8
# Max no of threads (if using a bounded task queue) is determined by
# calculating: ceil(available processors * factor)
max-pool-size-factor = 3.0
# Max number of threads to cap factor-based max number to
# (if using a bounded task queue)
max-pool-size-max = 64
# Specifies the bounded capacity of the task queue (< 1 == unbounded)
task-queue-size = -1
# Specifies which type of task queue will be used, can be "array" or
# "linked" (default)
task-queue-type = "linked"
# Allow core threads to time out
allow-core-timeout = on
}
"thread-pool-executor"
因此,总而言之,如果要使用 ThreadPoolExecutor,则需要设置默认调度程序以使用ThreadPoolExecutor,akka.default-dispatcher.executor = "thread-pool-executor"
然后指定该线程池执行程序的配置。
这有帮助吗?
干杯,√</p>