Class FlowableReplay.InnerSubscription<T>

java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicLong
io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay.InnerSubscription<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
Disposable, Serializable, org.reactivestreams.Subscription
Enclosing class:
FlowableReplay<T>

static final class FlowableReplay.InnerSubscription<T> extends AtomicLong implements org.reactivestreams.Subscription, Disposable
A Subscription that manages the request and cancellation state of a child subscriber in thread-safe manner.
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • parent

      The parent subscriber-to-source used to allow removing the child in case of child cancellation.
    • child

      final org.reactivestreams.Subscriber<? super T> child
      The actual child subscriber.
    • index

      Object index
      Holds an object that represents the current location in the buffer. Guarded by the emitter loop.
    • totalRequested

      final AtomicLong totalRequested
      Keeps the sum of all requested amounts.
    • emitting

      boolean emitting
      Indicates an emission state. Guarded by this.
    • missed

      boolean missed
      Indicates a missed update. Guarded by this.
    • CANCELLED

      static final long CANCELLED
      Indicates this child has been cancelled: the state is swapped in atomically and will prevent the dispatch() to emit (too many) values to a terminated child subscriber.
      See Also:
  • Constructor Details

  • Method Details

    • request

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

      public long produced(long n)
      Indicate that values have been emitted to this child subscriber by the dispatch() method.
      Parameters:
      n - the number of items emitted
      Returns:
      the updated request value (may indicate how much can be produced or a terminal state)
    • isDisposed

      public boolean isDisposed()
      Description copied from interface: Disposable
      Returns true if this resource has been disposed.
      Specified by:
      isDisposed in interface Disposable
      Returns:
      true if this resource has been disposed
    • cancel

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

      public void dispose()
      Description copied from interface: Disposable
      Dispose the resource, the operation should be idempotent.
      Specified by:
      dispose in interface Disposable
    • index

      <U> U index()
      Convenience method to auto-cast the index object.
      Type Parameters:
      U - type to cast index object
      Returns:
      the current index object