Class SequentialCancellable
- java.lang.Object
-
- io.servicetalk.concurrent.internal.SequentialCancellable
-
- All Implemented Interfaces:
Cancellable
public class SequentialCancellable extends java.lang.Object implements Cancellable
ACancellable
that can hold at most oneCancellable
that will be cancelled when this is cancelled.
-
-
Field Summary
-
Fields inherited from interface io.servicetalk.concurrent.Cancellable
IGNORE_CANCEL
-
-
Constructor Summary
Constructors Constructor Description SequentialCancellable()
Create a new instance with no currentCancellable
.SequentialCancellable(Cancellable cancellable)
Create a new instance with the currentCancellable
set tocancellable
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.boolean
isCancelled()
Returnstrue
if thisCancellable
is cancelled.void
nextCancellable(Cancellable next)
Sets the currentCancellable
.
-
-
-
Constructor Detail
-
SequentialCancellable
public SequentialCancellable()
Create a new instance with no currentCancellable
.
-
SequentialCancellable
public SequentialCancellable(Cancellable cancellable)
Create a new instance with the currentCancellable
set tocancellable
.- Parameters:
cancellable
- the initialCancellable
.
-
-
Method Detail
-
nextCancellable
public final void nextCancellable(Cancellable next)
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
-
isCancelled
public boolean isCancelled()
Returnstrue
if thisCancellable
is cancelled.- Returns:
true
if thisCancellable
is cancelled.
-
-