T - public class SettableFuture<T> extends Object implements Future<T>
| Constructor and Description |
|---|
SettableFuture() |
SettableFuture(ParamInvokeable<SettableFuture<T>> onSet,
ParamInvokeable<SettableFuture<T>> onCancel)
Create a SettableFuture which will potentially execute tasks upon set and upon cancel; the handlers will hold the exclusive
lock on the monitor for the duration of their execution
The handlers, (as they are ParamInvokeables) run synchronously with the call to set or cancel;
they run after the effects have taken place and after any interested parties waiting on the monitor have been notified |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel()
Cancels this Future
|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
fail(Throwable exception) |
T |
get() |
T |
get(Deadline deadline) |
T |
get(long quantity,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
protected void |
on_cancel() |
protected void |
on_set() |
T |
poll() |
void |
set(T value) |
public SettableFuture()
public SettableFuture(ParamInvokeable<SettableFuture<T>> onSet, ParamInvokeable<SettableFuture<T>> onCancel)
set or cancel;
they run after the effects have taken place and after any interested parties waiting on the monitor have been notifiedonSet - onCancel - public void set(T value)
public void fail(Throwable exception)
protected void on_set()
public boolean cancel(boolean mayInterruptIfRunning)
public boolean cancel()
protected void on_cancel()
public T get() throws InterruptedException, ExecutionException
get in interface Future<T>InterruptedExceptionExecutionExceptionpublic final T poll() throws ExecutionException
ExecutionExceptionpublic final T get(long quantity, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<T>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic final T get(Deadline deadline) throws InterruptedException, ExecutionException, TimeoutException
public boolean isCancelled()
isCancelled in interface Future<T>Copyright © 2017. All rights reserved.