Class FlowableReplay<T>

java.lang.Object
io.reactivex.rxjava3.core.Flowable<T>
io.reactivex.rxjava3.flowables.ConnectableFlowable<T>
io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay<T>
All Implemented Interfaces:
HasUpstreamPublisher<T>, org.reactivestreams.Publisher<T>

public final class FlowableReplay<T> extends ConnectableFlowable<T> implements HasUpstreamPublisher<T>
  • Field Details

    • source

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

      Holds the current subscriber that is, will be or just was subscribed to the source observable.
    • bufferFactory

      final Supplier<? extends FlowableReplay.ReplayBuffer<T>> bufferFactory
      A factory that creates the appropriate buffer for the ReplaySubscriber.
    • onSubscribe

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

      static final Supplier DEFAULT_UNBOUNDED_FACTORY
  • Constructor Details

  • Method Details

    • 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, 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, 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: