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?
No. The correct answer is no, a ScheduledExecutorService will not spawn new threads.