T - public class SettableFuture<T>
extends java.lang.Object
implements java.util.concurrent.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(java.lang.Throwable exception) |
T |
get() |
T |
get(Deadline deadline) |
T |
get(long quantity,
java.util.concurrent.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(java.lang.Throwable exception)
protected void on_set()
public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<T>public boolean cancel()
protected void on_cancel()
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic final T poll() throws java.util.concurrent.ExecutionException
java.util.concurrent.ExecutionExceptionpublic final T get(long quantity, 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.TimeoutExceptionpublic final T get(Deadline deadline) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<T>public boolean isDone()
isDone in interface java.util.concurrent.Future<T>Copyright © 2014. All Rights Reserved.