Class FlowableReplay<T>

    • Field Detail

      • source

        final Flowable<T> source
        The source observable.
      • current

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

        final org.reactivestreams.Publisher<T> onSubscribe
      • DEFAULT_UNBOUNDED_FACTORY

        static final Supplier DEFAULT_UNBOUNDED_FACTORY
    • Method Detail

      • multicastSelector

        public static <U,​R> Flowable<R> multicastSelector​(Supplier<? extends ConnectableFlowable<U>> connectableFactory,
                                                                Function<? super Flowable<U>,​? extends org.reactivestreams.Publisher<R>> selector)
        Given a connectable observable factory, it multicasts over the generated ConnectableObservable via a selector function.
        Type Parameters:
        U - the connectable observable type
        R - the result type
        Parameters:
        connectableFactory - the factory that returns a ConnectableFlowable for each individual subscriber
        selector - the function that receives a Flowable and should return another Flowable that will be subscribed to
        Returns:
        the new Observable instance
      • createFrom

        public static <T> ConnectableFlowable<T> createFrom​(Flowable<? extends T> source)
        Creates a replaying ConnectableObservable with an unbounded buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Publisher to use
        Returns:
        the new ConnectableObservable instance
      • create

        public static <T> ConnectableFlowable<T> create​(Flowable<T> source,
                                                        int bufferSize,
                                                        boolean eagerTruncate)
        Creates a replaying ConnectableObservable with a size bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Flowable to use
        bufferSize - the maximum number of elements to hold
        eagerTruncate - if true, the head reference is refreshed to avoid unwanted item retention
        Returns:
        the new ConnectableObservable instance
      • create

        public static <T> ConnectableFlowable<T> create​(Flowable<T> source,
                                                        long maxAge,
                                                        java.util.concurrent.TimeUnit unit,
                                                        Scheduler scheduler,
                                                        boolean eagerTruncate)
        Creates a replaying ConnectableObservable with a time bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Flowable to use
        maxAge - the maximum age of entries
        unit - the unit of measure of the age amount
        scheduler - the target scheduler providing the current time
        eagerTruncate - if true, the head reference is refreshed to avoid unwanted item retention
        Returns:
        the new ConnectableObservable instance
      • create

        public static <T> ConnectableFlowable<T> create​(Flowable<T> source,
                                                        long maxAge,
                                                        java.util.concurrent.TimeUnit unit,
                                                        Scheduler scheduler,
                                                        int bufferSize,
                                                        boolean eagerTruncate)
        Creates a replaying ConnectableObservable with a size and time bound buffer.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Flowable to use
        maxAge - the maximum age of entries
        unit - the unit of measure of the age amount
        scheduler - the target scheduler providing the current time
        bufferSize - the maximum number of elements to hold
        eagerTruncate - if true, the head reference is refreshed to avoid unwanted item retention
        Returns:
        the new ConnectableFlowable instance
      • create

        static <T> ConnectableFlowable<T> create​(Flowable<T> source,
                                                 Supplier<? extends FlowableReplay.ReplayBuffer<T>> bufferFactory)
        Creates a OperatorReplay instance to replay values of the given source Flowable.
        Type Parameters:
        T - the value type
        Parameters:
        source - the source Flowable to use
        bufferFactory - the factory to instantiate the appropriate buffer when the Flowable becomes active
        Returns:
        the ConnectableFlowable instance
      • source

        public org.reactivestreams.Publisher<T> source()
        Description copied from interface: HasUpstreamPublisher
        Returns the source Publisher.

        This method is intended to discover the assembly graph of sequences.

        Specified by:
        source in interface HasUpstreamPublisher<T>
        Returns:
        the source Publisher
      • subscribeActual

        protected void subscribeActual​(org.reactivestreams.Subscriber<? super T> s)
        Description copied from class: Flowable
        Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Subscribers.

        There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber; all hooks and basic safeguards have been applied by Flowable.subscribe(Subscriber) before this method gets called.

        Specified by:
        subscribeActual in class Flowable<T>
        Parameters:
        s - the incoming Subscriber, never null
      • reset

        public void reset()
        Description copied from class: ConnectableFlowable
        Resets this ConnectableFlowable into its fresh state if it has terminated.

        Calling this method on a fresh or active ConnectableFlowable has no effect.

        Scheduler:
        The behavior is determined by the implementor of this abstract class.
        Specified by:
        reset in class ConnectableFlowable<T>
      • connect

        public void connect​(Consumer<? super Disposable> connection)
        Description copied from class: ConnectableFlowable
        Instructs the ConnectableFlowable to begin emitting the items from its underlying Flowable to its Subscribers.
        Scheduler:
        The behavior is determined by the implementor of this abstract class.
        Specified by:
        connect in class ConnectableFlowable<T>
        Parameters:
        connection - the action that receives the connection subscription before the subscription to source happens allowing the caller to synchronously disconnect a synchronous source
        See Also:
        ReactiveX documentation: Connect