Class SequentialCancellable

  • All Implemented Interfaces:
    Cancellable

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

      • 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 Detail

      • 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
      • isCancelled

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