Both schedule() and scheduleAtfixedRate() use the same thread pool, but since you're creating a ScheduledExecutorService using the Executors class you're not (practically) bound to a maximum pool size. So even if the number of Runnables you scheduleAtFixedRate() is equal to the core pool size, that shouldn't prevent the Runnable cancellation tasks you schedule() from executing "on time", because new Threads are created as needed. I put "on time" in quotes, because their Threads still do require CPU time, which they might not get if the Runnables they're supposed to cancel are spin waiting, for instance.
What sort of granularity are we talking about by the way, TimeUnit wise?
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Joined: Jul 25, 2009
Thanks for the info.
The TimeUnit for intervalTimeUnit=MILLISECONDS and durationTimeUnit=SECONDS