|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxinmy.weixin4j.util.SettableFuture<T>
public class SettableFuture<T>
A ListenableFuture whose value can be set via set(Object) or
setException(Throwable). It may also be cancelled.
Inspired by com.google.common.util.concurrent.SettableFuture.
| Constructor Summary | |
|---|---|
SettableFuture()
|
|
| Method Summary | |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
|
T |
get()
Retrieve the value. |
T |
get(long timeout,
TimeUnit unit)
Retrieve the value. |
boolean |
isCancelled()
|
boolean |
isDone()
|
boolean |
set(T value)
Set the value of this future. |
boolean |
setException(Throwable exception)
Set the exception of this future. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SettableFuture()
| Method Detail |
|---|
public boolean set(T value)
true if the
value was set successfully, or false if the future has already
been set or cancelled.
value - the value that will be set.
true if the value was successfully set, else
false.public boolean setException(Throwable exception)
true if
the exception was set successfully, or false if the future has
already been set or cancelled.
exception - the value that will be set.
true if the exception was successfully set, else
false.public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface Future<T>public boolean isCancelled()
isCancelled in interface Future<T>public boolean isDone()
isDone in interface Future<T>
public T get()
throws InterruptedException,
ExecutionException
Will return the value if it has been set via set(Object), throw
an ExecutionException if it has been set via
setException(Throwable) or throw a
CancellationException if it has been
cancelled.
get in interface Future<T>InterruptedException
ExecutionException
public T get(long timeout,
TimeUnit unit)
throws InterruptedException,
ExecutionException,
TimeoutException
Will return the value if it has been set via set(Object), throw
an ExecutionException if it has been set via
setException(Throwable) or throw a
CancellationException if it has been
cancelled.
get in interface Future<T>timeout - the maximum time to wait.unit - the time unit of the timeout argument.
InterruptedException
ExecutionException
TimeoutException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||