V
- public class CompletedFuture<V>
extends java.lang.Object
implements java.util.concurrent.Future<V>
Represents a Future
that's already completed. All methods
return immediately. The result of the future is provided in this class'
constructor.
Constructor and Description |
---|
CompletedFuture(V result) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
V |
get() |
V |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
static <T> CompletedFuture<T> |
getNull() |
boolean |
isCancelled() |
boolean |
isDone() |
public CompletedFuture(V result)
public static <T> CompletedFuture<T> getNull()
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<V>
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<V>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<V>