public class SimpleSettableFuture<T>
extends java.lang.Object
implements java.util.concurrent.Future<T>
| Constructor and Description |
|---|
SimpleSettableFuture() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
Wait up to the timeout time for another Thread to set a value on this future.
|
T |
getOrThrow()
Convenience wrapper for
get() that re-throws get()'s Exceptions as
RuntimeExceptions. |
T |
getOrThrow(long timeout,
java.util.concurrent.TimeUnit unit)
Convenience wrapper for
get(long, TimeUnit) that re-throws get()'s Exceptions as
RuntimeExceptions. |
boolean |
isCancelled() |
boolean |
isDone() |
void |
set(T result)
Sets the result.
|
void |
setException(java.lang.Exception exception)
Sets the exception.
|
public void set(@Nullable
T result)
get(), they will immediately receive the
value. set or setException must only be called once.public void setException(java.lang.Exception exception)
get(), they will immediately receive
the exception. set or setException must only be called once.public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<T>public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<T>public boolean isDone()
isDone in interface java.util.concurrent.Future<T>@Nullable public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionException@Nullable public T 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<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutException@Nullable public T getOrThrow()
get() that re-throws get()'s Exceptions as
RuntimeExceptions.@Nullable public T getOrThrow(long timeout, java.util.concurrent.TimeUnit unit)
get(long, TimeUnit) that re-throws get()'s Exceptions as
RuntimeExceptions.