score:8

i would suggest using the standard java atomicinteger. you can increment it using the incrementandget() method, and obtain the current value via its get() method.

import java.util.concurrent.atomic.atomicinteger
...
val completed = new atomicinteger()
val futures = for(i <- 0 until nsteps) yield future {
    ...
    val content = blocking { ... http request ... }
    process(content)
    completed.incrementandget()
}
await.result(future.sequence(futures),2 hours)
...
print("completed: %d" format completed.get)

Related Query

More Query from same tag