Class SequentialCancellable

All Implemented Interfaces:

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.
      cancellable - the initial Cancellable.
  • Method Details

    • nextCancellable

      public final void nextCancellable(Cancellable next)
      Sets the current Cancellable.
      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.
      true if this Cancellable is cancelled.