@预定&调度程序:池大小到底有什么作用?
我想同时运行多个计划任务。
当配置 spring 这样做时,我可以向调度程序提供一个池大小:
<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor id="myExecutor" pool-size="32"/>
<task:scheduler id="myScheduler" pool-size="1000"/>
但是池大小在这里到底意味着什么?
这是否意味着它只能存储 1000 个预定方法,或者是否意味着只能同时处理 1000 个方法?
tldr; 如果 @Scheduled(fixedDelay=60) 注解的方法此时未执行(意味着它处于延迟之间),它是否会填满池?
I want to run several scheduled Tasks simultaneously.
When configuring spring to do so, I can supply a pool-size to the scheduler:
<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor id="myExecutor" pool-size="32"/>
<task:scheduler id="myScheduler" pool-size="1000"/>
But what exactly does the pool-size mean here?
Does it mean it can only store 1000 scheduled Methods or does it mean that only 1000 Methods can be processed at the same time?
tldr; If a @Scheduled(fixedDelay=60) annotated Method is NOT executed at the moment (meaning it's in between the delay), does it fill up the pool or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它指的是底层 ThreadPoolExecutor 可以同时池化的线程数量,即可以同时运行的方法的名义数量。
任务命名空间涉及您需要的许多细节。
我预计在大多数环境中 1000 个线程可能太多了。
It refers to the number of threads that can be pooled at once by the underlying ThreadPoolExecutor i.e. the notional number of methods that can be run at the same time.
The documentation on the task namespace goes into a lot of the detail you need.
I expect that 1000 threads is probably going to be far too many in most environments.