elizarov
12/30/2016, 11:57 PMTask.Delay(timeUnit)
returns a future that is complete after timeUnit
elapses. This corresponds in Java (and in Kotlin) to this:
val executor = Executors.newScheduledThreadPool(1) // create it once for your app
val f = executor.schedule({}, delay, timeUnit) // that is your future
Now if you need to wait, then you take take some library that provides await
suspending function on futures and do `await(f)`or f.await()
-- whethever code style you like more (we are moving to the later)