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
Future
whose result depends on anotherCancellable
process 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 boolean
cancel(boolean mayInterruptIfRunning)
boolean
completed(T result)
boolean
failed(java.lang.Exception exception)
void
setDependency(java.util.concurrent.Future<?> dependency)
void
setDependency(Cancellable dependency)
SetsCancellable
dependency 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:CancellableDependency
SetsCancellable
dependency on another ongoing process or operation represented byCancellable
.- Specified by:
setDependency
in interfaceCancellableDependency
-
setDependency
public void setDependency(java.util.concurrent.Future<?> dependency)
-
completed
public boolean completed(T result)
- Overrides:
completed
in classBasicFuture<T>
-
failed
public boolean failed(java.lang.Exception exception)
- Overrides:
failed
in classBasicFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<T>
- Overrides:
cancel
in classBasicFuture<T>
-
-