Class QueueDrainObserver<T,U,V>

Type Parameters:
T - the source type to which this subscriber will be subscribed
U - the value type in the queue
V - the value type the child subscriber accepts
All Implemented Interfaces:
Observer<T>, ObservableQueueDrain<U,V>
Direct Known Subclasses:
ObservableBufferExactBoundary.BufferExactBoundaryObserver, ObservableBufferTimed.BufferExactBoundedObserver, ObservableBufferTimed.BufferExactUnboundedObserver, ObservableBufferTimed.BufferSkipBoundedObserver

public abstract class QueueDrainObserver<T,U,V> extends QueueDrainSubscriberPad2 implements Observer<T>, ObservableQueueDrain<U,V>
Abstract base class for subscribers that hold another subscriber, a queue and requires queue-drain behavior.
  • Field Details

    • downstream

      protected final Observer<? super V> downstream
    • queue

      protected final SimplePlainQueue<U> queue
    • cancelled

      protected volatile boolean cancelled
    • done

      protected volatile boolean done
    • error

      protected Throwable error
  • Constructor Details

  • Method Details

    • cancelled

      public final boolean cancelled()
      Specified by:
      cancelled in interface ObservableQueueDrain<T,U>
    • done

      public final boolean done()
      Specified by:
      done in interface ObservableQueueDrain<T,U>
    • enter

      public final boolean enter()
      Specified by:
      enter in interface ObservableQueueDrain<T,U>
    • fastPathEmit

      protected final void fastPathEmit(U value, boolean delayError, Disposable dispose)
    • fastPathOrderedEmit

      protected final void fastPathOrderedEmit(U value, boolean delayError, Disposable disposable)
      Makes sure the fast-path emits in order.
      Parameters:
      value - the value to emit or queue up
      delayError - if true, errors are delayed until the source has terminated
      disposable - the resource to dispose if the drain terminates
    • error

      public final Throwable error()
      Specified by:
      error in interface ObservableQueueDrain<T,U>
    • leave

      public final int leave(int m)
      Description copied from interface: ObservableQueueDrain
      Adds m to the wip counter.
      Specified by:
      leave in interface ObservableQueueDrain<T,U>
      Parameters:
      m - the value to add
      Returns:
      the wip value after adding the value
    • accept

      public void accept(Observer<? super V> a, U v)
      Description copied from interface: ObservableQueueDrain
      Accept the value and return true if forwarded.
      Specified by:
      accept in interface ObservableQueueDrain<T,U>
      Parameters:
      a - the subscriber to deliver values to
      v - the value to deliver