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
Cancellable
that has a dependency on anotherCancellable
process or operation. Dependent process or operation will get cancelled if thisCancellable
itself 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 boolean
cancel()
Cancels the ongoing operation or process.boolean
isCancelled()
Determines whether the process or operation has been cancelled.void
setDependency(Cancellable dependency)
SetsCancellable
dependency 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:CancellableDependency
Determines whether the process or operation has been cancelled.- Specified by:
isCancelled
in interfaceCancellableDependency
- Returns:
- cancelled flag.
-
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
-
cancel
public boolean cancel()
Description copied from interface:Cancellable
Cancels the ongoing operation or process.- Specified by:
cancel
in interfaceCancellable
- Returns:
true
if the operation or process has been cancelled as a result of this method call orfalse
if it has already been cancelled or not started.
-
-