I'm using ScheduledThreadPoolExecutor to schedule a large number of tasks to run evenly over an hour.
There will be tens of thousands of tasks, and this may grow during surges in demand to hundreds of thousands or millions.
Normally, with a ThreadPoolExecutor, I can set the corePoolSize to a reasonable figure, such as 10 threads, and then allow the pool to grow as necessary.
However, the documentation for ScheduledThreadPoolExecutor says that:
because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect
This means that if I set the corePoolSize to 10, it will be capped at 10 threads. If I set the corePoolSize to 1000, it will instantly allocate 1000 threads, even though it may never reach that many active threads.
Is there an alternative to ScheduledThreadPoolExecutor that will let me set a high maximum thread count, without allocating all of those threads instantly?
FYI, the reason for the need for a huge active thread count is that the threads are I/O bound, and not CPU bound.