Class OperatorReplay<T>

    • Field Detail

      • source

        final Observable<? extends T> source
        The source observable.
      • current

        final java.util.concurrent.atomic.AtomicReference<OperatorReplay.ReplaySubscriber<T>> current
        Holds the current subscriber that is, will be or just was subscribed to the source observable.
      • DEFAULT_UNBOUNDED_FACTORY

        static final Func0 DEFAULT_UNBOUNDED_FACTORY
    • Method Detail

      • multicastSelector

        public static <T,​U,​R> Observable<R> multicastSelector​(Func0<? extends ConnectableObservable<U>> connectableFactory,
                                                                          Func1<? super Observable<U>,​? extends Observable<R>> selector)
        Given a connectable observable factory, it multicasts over the generated ConnectableObservable via a selector function.
        Type Parameters:
        T - the upstream's value type
        U - the intermediate value type of the ConnectableObservable
        R - the final value type provided by the selector function
        Parameters:
        connectableFactory - the factory that returns a ConnectableObservable instance
        selector - the function applied on the ConnectableObservable and returns the Observable the downstream will subscribe to.
        Returns:
        the Observable multicasting over a transformation of a ConnectableObserable
      • observeOn

        public static <T> ConnectableObservable<T> observeOn​(ConnectableObservable<T> co,
                                                             Scheduler scheduler)
        Child Subscribers will observe the events of the ConnectableObservable on the specified scheduler.
        Type Parameters:
        T - the value type
        Parameters:
        co - the ConnectableObservable to schedule on the specified scheduler
        scheduler - the target Scheduler instance
        Returns:
        the ConnectableObservable instance that is observed on the specified scheduler
      • create

        public static <T> ConnectableObservable<T> create​(Observable<? extends T> source)
        Creates a replaying ConnectableObservable with an unbounded buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Observable
        Returns:
        the replaying ConnectableObservable
      • create

        public static <T> ConnectableObservable<T> create​(Observable<? extends T> source,
                                                          int bufferSize)
        Creates a replaying ConnectableObservable with a size bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Observable
        bufferSize - the maximum number of elements buffered
        Returns:
        the replaying ConnectableObservable
      • create

        public static <T> ConnectableObservable<T> create​(Observable<? extends T> source,
                                                          long maxAge,
                                                          java.util.concurrent.TimeUnit unit,
                                                          Scheduler scheduler)
        Creates a replaying ConnectableObservable with a time bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Observable
        maxAge - the maximum age (exclusive) of each item when timestamped with the given scheduler
        unit - the time unit of the maximum age
        scheduler - the scheduler providing the notion of current time
        Returns:
        the replaying ConnectableObservable
      • create

        public static <T> ConnectableObservable<T> create​(Observable<? extends T> source,
                                                          long maxAge,
                                                          java.util.concurrent.TimeUnit unit,
                                                          Scheduler scheduler,
                                                          int bufferSize)
        Creates a replaying ConnectableObservable with a size and time bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Observable
        maxAge - the maximum age (exclusive) of each item when timestamped with the given scheduler
        unit - the time unit of the maximum age
        scheduler - the scheduler providing the notion of current time
        bufferSize - the maximum number of elements buffered
        Returns:
        the replaying ConnectableObservable
      • create

        static <T> ConnectableObservable<T> create​(Observable<? extends T> source,
                                                   Func0<? extends OperatorReplay.ReplayBuffer<T>> bufferFactory)
        Creates a OperatorReplay instance to replay values of the given source observable.
        Parameters:
        source - the source observable
        bufferFactory - the factory to instantiate the appropriate buffer when the observable becomes active
        Returns:
        the connectable observable