Package org.apache.hc.core5.concurrent
Class ComplexCancellable
- java.lang.Object
-
- org.apache.hc.core5.concurrent.ComplexCancellable
-
- All Implemented Interfaces:
Cancellable,CancellableDependency
public final class ComplexCancellable extends java.lang.Object implements CancellableDependency
Cancellablethat has a dependency on anotherCancellableprocess or operation. Dependent process or operation will get cancelled if thisCancellableitself is cancelled.- Since:
- 5.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicMarkableReference<Cancellable>dependencyRef
-
Constructor Summary
Constructors Constructor Description ComplexCancellable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel()Cancels the ongoing operation or process.booleanisCancelled()Determines whether the process or operation has been cancelled.voidsetDependency(Cancellable dependency)SetsCancellabledependency on another ongoing process or operation represented byCancellable.
-
-
-
Field Detail
-
dependencyRef
private final java.util.concurrent.atomic.AtomicMarkableReference<Cancellable> dependencyRef
-
-
Method Detail
-
isCancelled
public boolean isCancelled()
Description copied from interface:CancellableDependencyDetermines whether the process or operation has been cancelled.- Specified by:
isCancelledin interfaceCancellableDependency- Returns:
- cancelled flag.
-
setDependency
public void setDependency(Cancellable dependency)
Description copied from interface:CancellableDependencySetsCancellabledependency on another ongoing process or operation represented byCancellable.- Specified by:
setDependencyin interfaceCancellableDependency
-
cancel
public boolean cancel()
Description copied from interface:CancellableCancels the ongoing operation or process.- Specified by:
cancelin interfaceCancellable- Returns:
trueif the operation or process has been cancelled as a result of this method call orfalseif it has already been cancelled or not started.
-
-