Class SequentialCancellable

java.lang.Object
io.servicetalk.concurrent.internal.SequentialCancellable
All Implemented Interfaces:
Cancellable

public class SequentialCancellable extends Object implements Cancellable
A Cancellable that can hold at most one Cancellable that will be cancelled when this is cancelled.
  • Constructor Details

    • SequentialCancellable

      public SequentialCancellable()
      Create a new instance with no current Cancellable.
    • SequentialCancellable

      public SequentialCancellable(Cancellable cancellable)
      Create a new instance with the current Cancellable set to cancellable.
      Parameters:
      cancellable - the initial Cancellable.
  • Method Details

    • nextCancellable

      public final void nextCancellable(Cancellable next)
      Sets the current Cancellable.
      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 this Cancellable is not interested in the outcome of the execution.
      Specified by:
      cancel in interface Cancellable
    • cancelCurrent

      public void cancelCurrent()
      Cancels only the Cancellable that is currently held without side effect for any nextCancellable(Cancellable).
    • isCancelled

      public boolean isCancelled()
      Returns true if this Cancellable is cancelled.
      Returns:
      true if this Cancellable is cancelled.