Spring Boot Thread Pool 配置
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/15268554.html
application.properties
# thread pool schedule config spring.task.scheduling.thread-name-prefix=mock-task-schedule- spring.task.scheduling.pool.size=8 spring.task.scheduling.shutdown.await-termination=true # thread pool execution config spring.task.execution.thread-name-prefix=mock-task-executor- spring.task.execution.pool.core-size=8 spring.task.execution.pool.max-size=16 spring.task.execution.pool.keep-alive=60s spring.task.execution.pool.allow-core-thread-timeout=true spring.task.execution.pool.queue-capacity=100 spring.task.execution.shutdown.await-termination=true spring.task.execution.shutdown.await-termination-period=60
Note:Spring Boot 默认的线程池拒绝策略是 AbortPolicy,具体可以参考
TaskSchedulingAutoConfiguration、TaskSchedulingProperties.java、ThreadPoolTaskScheduler.java
TaskExecutionAutoConfiguration、TaskExecutionProperties.java 、ThreadPoolTaskExecutor.java
Reference
https://cloud.tencent.com/developer/article/1639857
强者自救 圣者渡人