Package org.apache.hc.core5.concurrent
Class ComplexFuture<T>
- java.lang.Object
-
- org.apache.hc.core5.concurrent.BasicFuture<T>
-
- org.apache.hc.core5.concurrent.ComplexFuture<T>
-
- Type Parameters:
T- the future result type of an asynchronous operation.
- All Implemented Interfaces:
java.util.concurrent.Future<T>,Cancellable,CancellableDependency
public final class ComplexFuture<T> extends BasicFuture<T> implements CancellableDependency
Futurewhose result depends on anotherCancellableprocess or operation or anotherFuture. Dependent process will get cancelled if the future itself is cancelled.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<Cancellable>dependencyRef
-
Constructor Summary
Constructors Constructor Description ComplexFuture(FutureCallback<T> callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel(boolean mayInterruptIfRunning)booleancompleted(T result)booleanfailed(java.lang.Exception exception)voidsetDependency(java.util.concurrent.Future<?> dependency)voidsetDependency(Cancellable dependency)SetsCancellabledependency on another ongoing process or operation represented byCancellable.-
Methods inherited from class org.apache.hc.core5.concurrent.BasicFuture
cancel, get, get, isCancelled, isDone
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.hc.core5.concurrent.Cancellable
cancel
-
Methods inherited from interface org.apache.hc.core5.concurrent.CancellableDependency
isCancelled
-
-
-
-
Field Detail
-
dependencyRef
private final java.util.concurrent.atomic.AtomicReference<Cancellable> dependencyRef
-
-
Constructor Detail
-
ComplexFuture
public ComplexFuture(FutureCallback<T> callback)
-
-
Method Detail
-
setDependency
public void setDependency(Cancellable dependency)
Description copied from interface:CancellableDependencySetsCancellabledependency on another ongoing process or operation represented byCancellable.- Specified by:
setDependencyin interfaceCancellableDependency
-
setDependency
public void setDependency(java.util.concurrent.Future<?> dependency)
-
completed
public boolean completed(T result)
- Overrides:
completedin classBasicFuture<T>
-
failed
public boolean failed(java.lang.Exception exception)
- Overrides:
failedin classBasicFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancelin interfacejava.util.concurrent.Future<T>- Overrides:
cancelin classBasicFuture<T>
-
-