Will a ScheduledExecutorService create new threads as needed?

Posted by Matt Ball on Stack Overflow See other posts from Stack Overflow or by Matt Ball
Published on 2012-06-25T21:12:42Z Indexed on 2012/06/25 21:15 UTC
Read the original article Hit count: 373

Filed under:
|

I'm using Executors.newScheduledThreadPool() to create a ScheduledExecutorService, specifying the number of threads like so:

int corePoolSize = 42;
ScheduledExecutorService foo = Executors.newScheduledThreadPool(corePoolSize);

According to the JavaDocs, the corePoolSize argument sets

the number of threads to keep in the pool, even if they are idle.

Does this mean that this ExecutorService implementation may create more than corePoolSize threads as needed, similar to a cached thread pool?

© Stack Overflow or respective owner

Related posts about java

Related posts about executorservice