Collector

gears.async.Future.Collector
class Collector[T](futures: Future[T]*)

Collects a list of futures into a channel of futures, arriving as they finish.

Attributes

See also

Future.awaitAll and Future.awaitFirst for simple usage of the collectors to get all results or the first succeeding one.

Example
// Sleep sort
val futs = numbers.map(i => Future(sleep(i.millis)))
val collector = Collector(futs*)
val output = mutable.ArrayBuffer[Int]()
for i <- 1 to futs.size:
 output += collector.results.read().await
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class MutableCollector[T]

Members list

Value members

Concrete methods

final def results: ReadableChannel[Future[T]]

Output channels of all finished futures.

Output channels of all finished futures.

Attributes