Class OnSubscribeRefCount<T>

  • Type Parameters:
    T - the value type
    All Implemented Interfaces:
    Action, Action1<Subscriber<? super T>>, Function, Observable.OnSubscribe<T>

    public final class OnSubscribeRefCount<T>
    extends java.lang.Object
    implements Observable.OnSubscribe<T>
    Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.
    • Field Detail

      • subscriptionCount

        final java.util.concurrent.atomic.AtomicInteger subscriptionCount
      • lock

        final java.util.concurrent.locks.ReentrantLock lock
        Use this lock for every subscription and disconnect action.
    • Constructor Detail

      • OnSubscribeRefCount

        public OnSubscribeRefCount​(ConnectableObservable<? extends T> source)
        Constructor.
        Parameters:
        source - observable to apply ref count to