@预定&调度程序:池大小到底有什么作用?

发布于 2024-10-05 00:40:01 字数 459 浏览 0 评论 0原文

我想同时运行多个计划任务。

当配置 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘴硬脾气大 2024-10-12 00:40:01

它指的是底层 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文