Concurrency 具有调用限制的单线程ScheduledThreadPoolExecutor

Concurrency 具有调用限制的单线程ScheduledThreadPoolExecutor,concurrency,timertask,scheduledexecutorservice,Concurrency,Timertask,Scheduledexecutorservice,我想利用java.util.concurrent.Executors启动一些运行程序。 问题是我想固定次数地发射它。给那些跑步者打固定的电话是很重要的 对我来说,使用Executors#newSingleThreadScheduledExecutor就足够了,所以我想知道为什么这不可能 谢谢我试图用TimerTask解决这个问题,但效果相同。 问题是如何有效、优雅和安全地运行-在一定次数的调用后关闭TimerTask、ScheduledExecutor Service…我找到了一些解决方案+但我

我想利用java.util.concurrent.Executors启动一些运行程序。 问题是我想固定次数地发射它。给那些跑步者打固定的电话是很重要的

对我来说,使用Executors#newSingleThreadScheduledExecutor就足够了,所以我想知道为什么这不可能


谢谢

我试图用TimerTask解决这个问题,但效果相同。
问题是如何有效、优雅和安全地运行-在一定次数的调用后关闭TimerTask、ScheduledExecutor Service…

我找到了一些解决方案+但我想它有机会对执行者非常稳定#newSingleThreadScheduledExecutor。我只是在我的Runnable/Callable On by条件中直接取消ScheduledFuture。ScheduledFuture作为executorService.scheduleAtFixedRate(myRunnable,…)获取