Attributes
Members list
Type members
Classlikes
Collects a list of futures into a channel of futures, arriving as they finish.
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
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class MutableCollector[T]
A promise is a Future that is be completed manually via the complete
method.
A promise is a Future that is be completed manually via the complete
method.
Attributes
- See also
-
Promise$.apply to create a new, empty promise.
Future.withResolver to create a passive Future from callback-style asynchronous calls.
- Companion
- object
- Supertypes
The group of handlers to be used in withResolver. As a Future is completed only once, only one of resolve/reject/complete may be used and only once.
The group of handlers to be used in withResolver. As a Future is completed only once, only one of resolve/reject/complete may be used and only once.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Create a future that asynchronously executes body
that wraps its execution in a scala.util.Try. The returned future is linked to the given Async.Spawn scope by default, i.e. it is cancelled when this scope ends.
Create a future that asynchronously executes body
that wraps its execution in a scala.util.Try. The returned future is linked to the given Async.Spawn scope by default, i.e. it is cancelled when this scope ends.
Attributes
A future that is immediately completed with the given result.
A future that is immediately completed with the given result.
Attributes
A future that immediately rejects with the given exception. Similar to Future.now(Failure(exception))
.
A future that immediately rejects with the given exception. Similar to Future.now(Failure(exception))
.
Attributes
A future that immediately resolves with the given result. Similar to Future.now(Success(result))
.
A future that immediately resolves with the given result. Similar to Future.now(Success(result))
.
Attributes
Create a promise that may be completed asynchronously using external means.
Create a promise that may be completed asynchronously using external means.
The body is run synchronously on the callers thread to setup an external asynchronous operation whose success/failure it communicates using the Resolver to complete the future.
If the external operation supports cancellation, the body can register one handler using Resolver.onCancel.
Attributes
Extensions
Extensions
Alternative parallel composition of this task with other
task. If either task succeeds, succeed with the success that was returned first. Otherwise, fail with the failure that was returned last.
Alternative parallel composition of this task with other
task. If either task succeeds, succeed with the success that was returned first. Otherwise, fail with the failure that was returned last.
Attributes
- See also
-
orWithCancel for an alternative version where the slower future is cancelled.
Like or
but the slower future is cancelled. If either task succeeds, succeed with the success that was returned first and the other is cancelled. Otherwise, fail with the failure that was returned last.
Like or
but the slower future is cancelled. If either task succeeds, succeed with the success that was returned first and the other is cancelled. Otherwise, fail with the failure that was returned last.
Attributes
Parallel composition of two futures. If both futures succeed, succeed with their values in a pair. Otherwise, fail with the failure that was returned first.
Parallel composition of two futures. If both futures succeed, succeed with their values in a pair. Otherwise, fail with the failure that was returned first.
Attributes
.await
for all futures in the sequence, returns the results in a sequence, or throws if any futures fail.
.await
for all futures in the sequence, returns the results in a sequence, or throws if any futures fail.
Attributes
Race all futures, returning the first successful value. Throws the last exception received, if everything fails.
Race all futures, returning the first successful value. Throws the last exception received, if everything fails.
Attributes
Like awaitFirst, but cancels all other futures as soon as the first future succeeds.