开发者

@Scheduled & scheduler: What exactly does pool-size do?

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜