Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@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?

like image 536
chzbrgla Avatar asked Oct 14 '22 20:10

chzbrgla


1 Answers

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.

like image 99
GaryF Avatar answered Oct 18 '22 01:10

GaryF