Class SubscriptionArbiter

java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicInteger
io.reactivex.rxjava3.internal.subscriptions.SubscriptionArbiter
All Implemented Interfaces:
Serializable, org.reactivestreams.Subscription
Direct Known Subclasses:
FlowableConcatArray.ConcatArraySubscriber, FlowableConcatMap.ConcatMapInner, FlowableOnErrorNext.OnErrorNextSubscriber, FlowableRepeatWhen.WhenSourceSubscriber, FlowableTimeout.TimeoutFallbackSubscriber, FlowableTimeoutTimed.TimeoutFallbackSubscriber

public class SubscriptionArbiter extends AtomicInteger implements org.reactivestreams.Subscription
Arbitrates requests and cancellation between Subscriptions.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • actual

      org.reactivestreams.Subscription actual
      The current subscription which may null if no Subscriptions have been set.
    • requested

      long requested
      The current outstanding request amount.
    • missedSubscription

      final AtomicReference<org.reactivestreams.Subscription> missedSubscription
    • missedRequested

      final AtomicLong missedRequested
    • missedProduced

      final AtomicLong missedProduced
    • cancelOnReplace

      final boolean cancelOnReplace
    • cancelled

      volatile boolean cancelled
    • unbounded

      protected boolean unbounded
  • Constructor Details

    • SubscriptionArbiter

      public SubscriptionArbiter(boolean cancelOnReplace)
  • Method Details

    • setSubscription

      public final void setSubscription(org.reactivestreams.Subscription s)
      Atomically sets a new subscription.
      Parameters:
      s - the subscription to set, not null (verified)
    • request

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

      public final void produced(long n)
    • cancel

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

      final void drain()
    • drainLoop

      final void drainLoop()
    • isUnbounded

      public final boolean isUnbounded()
      Returns true if the arbiter runs in unbounded mode.
      Returns:
      true if the arbiter runs in unbounded mode
    • isCancelled

      public final boolean isCancelled()
      Returns true if the arbiter has been cancelled.
      Returns:
      true if the arbiter has been cancelled