Class SinglePostCompleteSubscriber<T,R>

java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicLong
io.reactivex.rxjava3.internal.subscribers.SinglePostCompleteSubscriber<T,R>
Type Parameters:
T - the input value type
R - the output value type
All Implemented Interfaces:
FlowableSubscriber<T>, Serializable, org.reactivestreams.Subscriber<T>, org.reactivestreams.Subscription
Direct Known Subclasses:
FlowableConcatWithMaybe.ConcatWithSubscriber, FlowableConcatWithSingle.ConcatWithSubscriber, FlowableMapNotification.MapNotificationSubscriber, FlowableMaterialize.MaterializeSubscriber, FlowableOnErrorReturn.OnErrorReturnSubscriber

public abstract class SinglePostCompleteSubscriber<T,R> extends AtomicLong implements FlowableSubscriber<T>, org.reactivestreams.Subscription
Relays signals from upstream according to downstream requests and allows signalling a final value followed by onComplete in a backpressure-aware manner.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • downstream

      protected final org.reactivestreams.Subscriber<? super R> downstream
      The downstream consumer.
    • upstream

      protected org.reactivestreams.Subscription upstream
      The upstream subscription.
    • value

      protected R value
      The last value stored in case there is no request for it.
    • produced

      protected long produced
      Number of values emitted so far.
    • COMPLETE_MASK

      static final long COMPLETE_MASK
      Masks out the 2^63 bit indicating a completed state.
      See Also:
    • REQUEST_MASK

      static final long REQUEST_MASK
      Masks out the lower 63 bit holding the current request amount.
      See Also:
  • Constructor Details

    • SinglePostCompleteSubscriber

      public SinglePostCompleteSubscriber(org.reactivestreams.Subscriber<? super R> downstream)
  • Method Details

    • onSubscribe

      public void onSubscribe(org.reactivestreams.Subscription s)
      Description copied from interface: FlowableSubscriber
      Implementors of this method should make sure everything that needs to be visible in Subscriber.onNext(Object) is established before calling Subscription.request(long). In practice this means no initialization should happen after the request() call and additional behavior is thread safe in respect to onNext.
      Specified by:
      onSubscribe in interface FlowableSubscriber<T>
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<T>
    • complete

      protected final void complete(R n)
      Signals the given value and an onComplete if the downstream is ready to receive the final value.
      Parameters:
      n - the value to emit
    • onDrop

      protected void onDrop(R n)
      Called in case of multiple calls to complete.
      Parameters:
      n - the value dropped
    • request

      public final void request(long n)
      Specified by:
      request in interface org.reactivestreams.Subscription
    • cancel

      public void cancel()
      Specified by:
      cancel in interface org.reactivestreams.Subscription