Class SequentialCancellable
java.lang.Object
io.servicetalk.concurrent.internal.SequentialCancellable
- All Implemented Interfaces:
Cancellable
A
Cancellable
that can hold at most one Cancellable
that will be cancelled when this is cancelled.-
Field Summary
Fields inherited from interface io.servicetalk.concurrent.Cancellable
IGNORE_CANCEL
-
Constructor Summary
ConstructorDescriptionCreate a new instance with no currentCancellable
.SequentialCancellable
(Cancellable cancellable) Create a new instance with the currentCancellable
set tocancellable
. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
cancel()
Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellable
is not interested in the outcome of the execution.void
Cancels only theCancellable
that is currently held without side effect for anynextCancellable(Cancellable)
.boolean
Returnstrue
if thisCancellable
is cancelled.final void
nextCancellable
(Cancellable next) Sets the currentCancellable
.
-
Constructor Details
-
SequentialCancellable
public SequentialCancellable()Create a new instance with no currentCancellable
. -
SequentialCancellable
Create a new instance with the currentCancellable
set tocancellable
.- Parameters:
cancellable
- the initialCancellable
.
-
-
Method Details
-
nextCancellable
Sets the currentCancellable
.- Parameters:
next
- to set.
-
cancel
public final void cancel()Description copied from interface:Cancellable
Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellable
is not interested in the outcome of the execution.- Specified by:
cancel
in interfaceCancellable
-
cancelCurrent
public void cancelCurrent()Cancels only theCancellable
that is currently held without side effect for anynextCancellable(Cancellable)
. -
isCancelled
public boolean isCancelled()Returnstrue
if thisCancellable
is cancelled.- Returns:
true
if thisCancellable
is cancelled.
-