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
ConstructorsConstructorDescriptionCreate a new instance with no currentCancellable.SequentialCancellable(Cancellable cancellable) Create a new instance with the currentCancellableset tocancellable. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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.voidCancels only theCancellablethat is currently held without side effect for anynextCancellable(Cancellable).booleanReturnstrueif thisCancellableis cancelled.final voidnextCancellable(Cancellable next) Sets the currentCancellable.
-
Constructor Details
-
SequentialCancellable
public SequentialCancellable()Create a new instance with no currentCancellable. -
SequentialCancellable
Create a new instance with the currentCancellableset tocancellable.- Parameters:
cancellable- the initialCancellable.
-
-
Method Details
-
nextCancellable
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
-
cancelCurrent
public void cancelCurrent()Cancels only theCancellablethat is currently held without side effect for anynextCancellable(Cancellable). -
isCancelled
public boolean isCancelled()Returnstrueif thisCancellableis cancelled.- Returns:
trueif thisCancellableis cancelled.
-