That's a good question. Perhaps you could call cancel() on the ScheduledFuture<T> that you received from the scheduledAtFixedRate() call, send the task manually using submit() , and then reassign the fixed rate task when Future returns? You would have to check that the task is not running yet, I suppose.
Some pseudo codes ...
ScheduledFuture<Thingy> sf = executor.scheduleAtFixedRate(myTask, etc...); sf.cancel(); final Future<Thingy> f = executor.submit(myTask); f.get(); sf = executor.scheduleAtFixedRate(myTask, etc...);
I have never done this, this is an interesting question.
source share