Suppose we have something like this:
while (true) {
val job = Future { doSomething(); 1 }
val timeout = Future { Thread.sleep(1000); 2 }
val both = for (j <- job; t <- timeout) {
println("Done")
}
Await.result(both)
}
What is the idiomatic solution for this using rx-java/scala?
UPDATE: a little more clarification, if not obvious from code.
Let tsn and ten be timestamp of start and end of a doSomething()
job respectively.
Then the next job should be scheduled at tsn+1 = max ( ten , tsn + 1 second ).