T
- the future result type of an asynchronous operation.public final class ComplexFuture<T> extends BasicFuture<T> implements CancellableDependency
Future
whose result depends on another Cancellable
process
or operation or another Future
. Dependent process will get cancelled
if the future itself is cancelled.Constructor and Description |
---|
ComplexFuture(FutureCallback<T> callback) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task.
|
boolean |
completed(T result) |
boolean |
failed(Exception exception) |
void |
setDependency(Cancellable dependency)
Sets
Cancellable dependency on another ongoing process or
operation represented by Cancellable . |
void |
setDependency(Future<?> dependency) |
cancel, get, get, isCancelled, isDone
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isCancelled
cancel
public ComplexFuture(FutureCallback<T> callback)
public boolean cancel(boolean mayInterruptIfRunning)
Future
After this method returns, subsequent calls to Future.isDone()
will always return true. Subsequent calls
to Future.isCancelled()
will always return true if this method returned true.
cancel
in interface Future<T>
cancel
in class BasicFuture<T>
mayInterruptIfRunning
- true if the thread executing this task should be interrupted; otherwise, in-progress tasks
are allowed to completepublic boolean completed(T result)
completed
in class BasicFuture<T>
public boolean failed(Exception exception)
failed
in class BasicFuture<T>
public void setDependency(Cancellable dependency)
CancellableDependency
Cancellable
dependency on another ongoing process or
operation represented by Cancellable
.setDependency
in interface CancellableDependency
public void setDependency(Future<?> dependency)