Class SequentialCancellable
- java.lang.Object
-
- io.servicetalk.concurrent.internal.SequentialCancellable
-
- All Implemented Interfaces:
Cancellable
public class SequentialCancellable extends java.lang.Object implements Cancellable
ACancellablethat can hold at most oneCancellablethat 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 currentCancellableset tocancellable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Sends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellableis not interested in the outcome of the execution.booleanisCancelled()Returnstrueif thisCancellableis cancelled.voidnextCancellable(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 currentCancellableset 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:CancellableSends a hint to the producer of the associated asynchronous execution that the consumer related to thisCancellableis not interested in the outcome of the execution.- Specified by:
cancelin interfaceCancellable
-
isCancelled
public boolean isCancelled()
Returnstrueif thisCancellableis cancelled.- Returns:
trueif thisCancellableis cancelled.
-
-