Prevent Scheduler from starting another task before previous task finishes


#1
  • Scala/Akka Application
  • I have a task that processes entries in a batch.
  • Assuming the scheduler runs after every 5 seconds and the current task being executed takes 7 seconds.
    i. Will the scheduler start another instance of the Task before the previous task finishes?
    ii. How can I prevent a scheduler from starting an instance of a task before the previous once completes?

Code samples
val task = new Runnable { def run() { processBatch } }

scheduler.schedule(
initialDelay = 0 seconds,
interval = 5 seconds,
runnable = task)


#2

I suspect you’re more likely to get an answer over on the Akka forum.


#3

Thanks so much jducoeur for the feedback, please note that I will submit the question in akka forum.