Package com.arpnetworking.utility
Class CollectFutureBuilder<T>
java.lang.Object
com.arpnetworking.utility.CollectFutureBuilder<T>
- Type Parameters:
T
- Return future type
Collects futures and provides them in a combined promise.
- Author:
- Brandon Arp (brandon dot arp at inscopemetrics dot com)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFuture
(scala.concurrent.Future<?> future) Registers aFuture
in the collection.scala.concurrent.Future<T>
build
(scala.concurrent.ExecutionContext context) Builds the final future.Method to create a<T>
from the completedFuture
s.setFutures
(List<scala.concurrent.Future<?>> futures) Sets the list ofFuture
s to wait on.
-
Constructor Details
-
CollectFutureBuilder
public CollectFutureBuilder()
-
-
Method Details
-
map
Method to create a<T>
from the completedFuture
s.- Parameters:
callback
- Callback function- Returns:
- this builder
-
addFuture
Registers aFuture
in the collection. A future must be registered in order to be waited on.- Parameters:
future
- Future to register- Returns:
- this builder
-
setFutures
Sets the list ofFuture
s to wait on.- Parameters:
futures
- The list of futures- Returns:
- this builder
-
build
Builds the final future.- Parameters:
context
- context to execute the futures on- Returns:
- the new future
-