|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.common.util.concurrent.AbstractFuture<V> com.google.common.util.concurrent.AbstractListenableFuture<V> com.google.common.util.concurrent.ValueFuture<V>
@Beta public class ValueFuture<V>
A simple ListenableFuture that holds a value or an exception.
Method Summary | ||
---|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task. |
|
static
|
create()
Creates a new ValueFuture in the default state. |
|
boolean |
set(V newValue)
Sets the value of this future. |
|
boolean |
setException(Throwable t)
Sets the future to having failed with the given exception. |
Methods inherited from class com.google.common.util.concurrent.AbstractListenableFuture |
---|
addListener, done |
Methods inherited from class com.google.common.util.concurrent.AbstractFuture |
---|
cancel, get, get, isCancelled, isDone |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.concurrent.Future |
---|
get, get, isCancelled, isDone |
Method Detail |
---|
public static <T> ValueFuture<T> create()
ValueFuture
in the default state.
public boolean set(@Nullable V newValue)
true
if
the value was successfully set, or false
if the future has already
been set or cancelled.
set
in class AbstractFuture<V>
newValue
- the value the future should hold.
public boolean setException(Throwable t)
true
if the exception was successfully set,
or false
if the future has already been set or cancelled.
setException
in class AbstractFuture<V>
t
- the exception the future should hold.
public boolean cancel(boolean mayInterruptIfRunning)
After this method returns, subsequent calls to Future.isDone()
will
always return true. Subsequent calls to Future.isCancelled()
will always return true if this method returned true.
A ValueFuture is never considered in the running state, so the
mayInterruptIfRunning
argument is ignored.
cancel
in interface Future<V>
cancel
in class AbstractFuture<V>
mayInterruptIfRunning
- true if the thread executing this
task should be interrupted; otherwise, in-progress tasks are allowed
to complete
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |