public class FutureImpl<T> extends Object implements Future<T>
Future<T> which is nicely missing from the JDK, sigh.| Constructor and Description |
|---|
FutureImpl() |
FutureImpl(Exception error)
Create a future that's already done, with the specified error.
|
FutureImpl(String description) |
FutureImpl(String description,
T result) |
FutureImpl(T result)
Create a future that's already done, with the specified result.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get()
Get the result, wait if it's not yet available.
|
T |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
set(Exception reason)
Mark the future as ready, but aborted with an exception.
|
void |
set(T value)
Return the result, and notify any waiters.
|
String |
toString() |
public FutureImpl()
public FutureImpl(@Nullable T result)
result - public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled in interface Future<T>public T get() throws InterruptedException, ExecutionException
get in interface Future<T>InterruptedExceptionExecutionExceptionFuture.get()public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic void set(@Nullable T value)
value - public void set(@Nonnull Exception reason)
reason - Copyright © 2017 etc.to. All rights reserved.