Package mondrian.util
Class CompletedFuture<V>
java.lang.Object
mondrian.util.CompletedFuture<V>
- All Implemented Interfaces:
Future<V>
Implementation of
Future that has already completed.-
Constructor Summary
ConstructorsConstructorDescriptionCompletedFuture(V value, ExecutionException exception) Creates a CompletedFuture. -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) static <T> CompletedFuture<T>Creates a completed future indicating failure.get()booleanbooleanisDone()static <T> CompletedFuture<T>success(T t) Creates a completed future indicating success.
-
Constructor Details
-
CompletedFuture
Creates a CompletedFuture.If
throwableis not null, the computation is deemed to have failed. The exception will be thrown (wrapped in aExecutionException) whenget()orget(long, java.util.concurrent.TimeUnit)are invoked.If exception is null, the computation is deemed to have succeeded. In this case, a null value in
valuejust means that the computation yielded a null result.- Parameters:
value- Value (may be null)exception- Exception that occurred while computing result
-
-
Method Details
-
success
Creates a completed future indicating success.- Parameters:
t- Result of computation- Returns:
- Completed future that will yield the result
-
fail
Creates a completed future indicating failure.- Parameters:
e- Exception- Returns:
- Completed future that will throw
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<V>- Throws:
ExecutionException
-
get
- Specified by:
getin interfaceFuture<V>- Throws:
ExecutionException
-