0

I would like to utilize the java.util.concurrent.Executors to fire some runner. The problem is that i wanted to fire it fixed amount of times. It is important to call those runners a fixed rate.

For me it is perfectly sufficient use a Executors#newSingleThreadScheduledExecutor so i wonder why this is not possible ....

Thanks

maryoush
  • 173
  • 1
  • 12

1 Answers1

0

I was trying to aproach this with TimerTask but the same effect. Problem is how to effectively, elegant and treadsafely - shutdown TimerTask, ScheduledExecutorService after certain number of calls ...

maryoush
  • 173
  • 1
  • 12
  • I found some solution + but i guess it has the chance to quite stable for _Executors#newSingleThreadScheduledExecutor_. I just cancel ScheduledFuture directly in my Runnable/Callable upon by condition. The ScheduledFuture is gotten as the executorService.scheduleAtFixedRate(myRunnable,....) – maryoush Mar 28 '13 at 21:59