Package org.openrefine.process
Class ProgressingFutures
- java.lang.Object
-
- org.openrefine.process.ProgressingFutures
-
public class ProgressingFutures extends Object
Utilities aroundProgressingFuture
, added as static methods so as not to overload the interfaces with default methods.
-
-
Constructor Summary
Constructors Constructor Description ProgressingFutures()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ProgressingFuture<T>
exception(Exception e)
A precomputed future in an error state, defined by the supplied exception.static <T> ProgressingFuture<T>
fromListenableFuture(com.google.common.util.concurrent.ListenableFuture<T> future, Executor executor)
Wraps a listenable future into a progressing future which does not support reporting progress or pausing.static <T> ProgressingFuture<T>
immediate(T value)
A future whose result is already computed.static <T,U>
ProgressingFuture<U>transform(ProgressingFuture<T> future, com.google.common.base.Function<T,U> function, com.google.common.util.concurrent.ListeningExecutorService executor)
Chaining a future with a transformation.
-
-
-
Method Detail
-
immediate
public static <T> ProgressingFuture<T> immediate(T value)
A future whose result is already computed.
-
exception
public static <T> ProgressingFuture<T> exception(Exception e)
A precomputed future in an error state, defined by the supplied exception.
-
fromListenableFuture
public static <T> ProgressingFuture<T> fromListenableFuture(com.google.common.util.concurrent.ListenableFuture<T> future, Executor executor)
Wraps a listenable future into a progressing future which does not support reporting progress or pausing.
-
transform
public static <T,U> ProgressingFuture<U> transform(ProgressingFuture<T> future, com.google.common.base.Function<T,U> function, com.google.common.util.concurrent.ListeningExecutorService executor)
Chaining a future with a transformation.- Parameters:
future
- the future containing the first computation in the chainfunction
- the second computation to apply on top of the result of the future. This function must be relatively quick as no progress reporting or pausing for it will be supported by the returned futureexecutor
- the executor to use to schedule the execution of the second computation- Returns:
- a future which combines the two computations
-
-