T
- Future<T>
RunnableCallableFuture
public class SettableFuture<T> extends Object implements Future<T>
Constructor | 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 | Description |
---|---|---|
boolean |
cancel() |
Cancels this Future
|
boolean |
cancel(boolean mayInterruptIfRunning) |
|
void |
fail(Throwable exception) |
|
T |
get() |
|
T |
get(long quantity,
TimeUnit unit) |
|
T |
get(Deadline deadline) |
|
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>
InterruptedException
ExecutionException
public final T poll() throws ExecutionException
ExecutionException
public final T get(long quantity, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public final T get(Deadline deadline) throws InterruptedException, ExecutionException, TimeoutException
public boolean isCancelled()
isCancelled
in interface Future<T>
Copyright © 2018. All rights reserved.