Class FlowableCreate.BaseEmitter<T>

java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicLong
io.reactivex.rxjava3.internal.operators.flowable.FlowableCreate.BaseEmitter<T>
All Implemented Interfaces:
Emitter<T>, FlowableEmitter<T>, Serializable, org.reactivestreams.Subscription
Direct Known Subclasses:
FlowableCreate.BufferAsyncEmitter, FlowableCreate.LatestAsyncEmitter, FlowableCreate.MissingEmitter, FlowableCreate.NoOverflowBaseAsyncEmitter
Enclosing class:
FlowableCreate<T>

abstract static class FlowableCreate.BaseEmitter<T> extends AtomicLong implements FlowableEmitter<T>, org.reactivestreams.Subscription
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • downstream

      final org.reactivestreams.Subscriber<? super T> downstream
    • serial

      final SequentialDisposable serial
  • Constructor Details

    • BaseEmitter

      BaseEmitter(org.reactivestreams.Subscriber<? super T> downstream)
  • Method Details

    • onComplete

      public void onComplete()
      Description copied from interface: Emitter
      Signal a completion.
      Specified by:
      onComplete in interface Emitter<T>
    • completeDownstream

      protected void completeDownstream()
    • onError

      public final void onError(Throwable e)
      Description copied from interface: Emitter
      Signal a Throwable exception.
      Specified by:
      onError in interface Emitter<T>
      Parameters:
      e - the Throwable to signal, not null
    • tryOnError

      public final boolean tryOnError(Throwable e)
      Description copied from interface: FlowableEmitter
      Attempts to emit the specified Throwable error if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.

      Unlike Emitter.onError(Throwable), the RxjavaPlugins.onError is not called if the error could not be delivered.

      History: 2.1.1 - experimental

      Specified by:
      tryOnError in interface FlowableEmitter<T>
      Parameters:
      e - the throwable error to signal if possible
      Returns:
      true if successful, false if the downstream is not able to accept further events
    • signalError

      public boolean signalError(Throwable e)
    • errorDownstream

      protected boolean errorDownstream(Throwable e)
    • cancel

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

      void onUnsubscribed()
    • isCancelled

      public final boolean isCancelled()
      Description copied from interface: FlowableEmitter
      Returns true if the downstream cancelled the sequence or the emitter was terminated via Emitter.onError(Throwable), Emitter.onComplete() or a successful FlowableEmitter.tryOnError(Throwable).

      This method is thread-safe.

      Specified by:
      isCancelled in interface FlowableEmitter<T>
      Returns:
      true if the downstream cancelled the sequence or the emitter was terminated
    • request

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

      void onRequested()
    • setDisposable

      public final void setDisposable(Disposable d)
      Description copied from interface: FlowableEmitter
      Sets a Disposable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

      This method is thread-safe.

      Specified by:
      setDisposable in interface FlowableEmitter<T>
      Parameters:
      d - the disposable, null is allowed
    • setCancellable

      public final void setCancellable(Cancellable c)
      Description copied from interface: FlowableEmitter
      Sets a Cancellable on this emitter; any previous Disposable or Cancellable will be disposed/cancelled.

      This method is thread-safe.

      Specified by:
      setCancellable in interface FlowableEmitter<T>
      Parameters:
      c - the Cancellable resource, null is allowed
    • requested

      public final long requested()
      Description copied from interface: FlowableEmitter
      The current outstanding request amount.

      This method is thread-safe.

      Specified by:
      requested in interface FlowableEmitter<T>
      Returns:
      the current outstanding request amount
    • serialize

      public final FlowableEmitter<T> serialize()
      Description copied from interface: FlowableEmitter
      Ensures that calls to onNext, onError and onComplete are properly serialized.
      Specified by:
      serialize in interface FlowableEmitter<T>
      Returns:
      the serialized FlowableEmitter
    • toString

      public String toString()
      Overrides:
      toString in class AtomicLong